svelte-typeahead icon indicating copy to clipboard operation
svelte-typeahead copied to clipboard

let:value no longer works since Svelte 4

Open schindld opened this issue 1 year ago • 1 comments

Svelte 4 got rid of named slot bindings: https://svelte.dev/docs/v4-migration-guide#default-slot-bindings

So, the "no-results" fragment in the readme throws an error (ReferenceError: value is not defined).

schindld avatar Jul 21 '23 15:07 schindld

Looks like moving the variable to the "no-results" slot fixes it. So, change

<Typeahead value="abcd" {data} {extract} let:value>
  <svelte:fragment slot="no-results">
    No results found for "{value}"
  </svelte:fragment>
</Typeahead>

to

<Typeahead value="abcd" {data} {extract}>
  <svelte:fragment slot="no-results" let:value>
    No results found for "{value}"
  </svelte:fragment>
</Typeahead>

schindld avatar Jul 21 '23 15:07 schindld