metonym / svelte-typeahead

Accessible, fuzzy search typeahead component
https://metonym.github.io/svelte-typeahead
MIT License
222 stars 18 forks source link

let:value no longer works since Svelte 4 #79

Open schindld opened 1 year ago

schindld commented 1 year ago

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 commented 1 year ago

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>