Skip to content
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

Checkboxes update bound variables AFTER on:change handler is called #5091

Closed
buhrmi opened this issue Jul 1, 2020 · 4 comments
Closed

Checkboxes update bound variables AFTER on:change handler is called #5091

buhrmi opened this issue Jul 1, 2020 · 4 comments

Comments

@buhrmi
Copy link
Contributor

buhrmi commented Jul 1, 2020

Describe the bug
On a checkbox, during the call of the event handler set in on:change, the variable bound with bind:checked={variable} has the old value.

To Reproduce
See https://svelte.dev/repl/76b4ada2599f41848b5a6c760df87a75?version=3 and look at the console output. It's true when it should be false and false when it should be true.

@buhrmi
Copy link
Contributor Author

buhrmi commented Jul 1, 2020

Never mind. Changing the order of the bind and the handler fixes this. TIL.

@buhrmi buhrmi closed this as completed Jul 1, 2020
@gamelaster
Copy link

I had same issue too, I think this should be mentioned somewhere in docs.

@Conduitry
Copy link
Member

There's an issue for describing this better in the docs, #4616.

@ImmanentizeTheEschaton
Copy link

Confused me for a bit until I found this thread.

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

No branches or pull requests

4 participants