rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.25k stars 175 forks source link

A strange issue with reproduction... #681

Closed frederikhors closed 1 month ago

frederikhors commented 1 month ago

I created a REPL for a strange issue.

REPL: https://stackblitz.com/edit/sveltejs-kit-template-default-9zkjpt?file=src%2Froutes%2Fabout%2FCustomSelect.svelte

Steps to reproduce

  1. Open the REPL

  2. Open the browser console

  3. Go on the "About" page using the link

  4. No message in console

  5. Now comment the line:

    result = id;
  6. And comment out the line:

    // setTimeout(() => (result = id), 0);
  7. Go on Home page

  8. Go on About page

  9. Now in the console you can see the message: "handleInput"

Why is this happening?

Is setTimeout really needed?

frederikhors commented 1 month ago

Maybe the issue https://github.com/rob-balfre/svelte-select/issues/682 is more accurate.