Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mariansimecek opened this issue Apr 20, 2024 · 0 comments · Fixed by #11267
Closed
Assignees
Milestone

Comments

@mariansimecek
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants