Skip to content

Svelte 5 Bug - spreading value and oninput props make snippet disappear on input change  #11266

Closed
@mariansimecek

Description

@mariansimecek

Describe the bug

Not sure what is happening, but when I type something into the input, it makes the snippet disappear. It depends on the order of attributes on the <Child/>. This seems to be an issue only when values and getProps are inside the class.

<script>
  import Child from './Child.svelte';

  class Store {
    values = $state();
    getProps() {
      return { oninput: (e) => (this.values = e.currentTarget.value), value: this.values };
    }
  }

  const store = new Store();
</script>

{#snippet label()}
  I will disappear
{/snippet}
<p>
	<Child {label} {...store.getProps()} />
</p>
<!-- Child.svelte -->
<script>
  let { oninput, label } = $props();
</script>

<label>
  {@render label()}
  <input {oninput} />
</label>

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAA41RS2vEIBD-K4MtbALB3LPZpaWn3grtrenBJrMbwajoZJci_veiyW5fl57E8Xs6gR2kQs-a18C0mJA17N5aVjH6sOniT6gIWcW8mV2fJq3vnbS07zSAnKxxBA-jVAMcnJlgw-t84wtxs-10AvZKeA_PZBxCSAOAk1AzetjBrSdBWJTbZX5EenLG-qK8IAEc0uw0BDBaajtTAwWWsNtDQaP0_CqFvJ-dQ00vwh2RloeyWrwa-A6Oq11MR1xTGu0JfE65A43nJXGO1tbX3p0ON15La5FAiXdURZlVHuEslYJBemEtCtfpUK-42OnWJiq1y2eFTIwQOOfZkH_1jlDvk2EmaFaxyQzyIHFgDbkZY3VdVdb677IU0tcPVktyiGkBdvH93bLNkMwNdw71gO5H3zYrQVglI1glehyNGtDtuhwKvJmQRqmPHVtbXUT_9nqLn4VMNyCOAgAA

Logs

No response

System Info

Svelte REPL 5.0.0-next.110

Severity

annoyance

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions