Skip to content

Conditions (IFs) does not get updated inside transition blocks. #4986

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
quentincaffeino opened this issue Jun 7, 2020 · 2 comments
Closed

Comments

@quentincaffeino
Copy link

To Reproduce
https://svelte.dev/repl/60298ac9b7854a6a99b814fb17e54353?version=3.23.0

Repl Description
In this repl there are three buttons. First one toggles a transition and display a hidden block. Inside this block there are two more buttons which change value b that has conditions on it and after changing a value the block gets hidden.

The problem is variable b inside template is not getting updated nor before nor after the out transition. It is only updated when first button is clicked once again, to reveal hidden element.

Same happens if I use stores instead of reactive variable b. Which is how I've discovered this problem in my project.

Expected behavior
Variable b is updated before transition is run.

Additional context
Might be related with: #4064 #4696

@majkelbed
Copy link
Contributor

Use tick before toggleA() and it seems to work fine :)
https://svelte.dev/docs#tick

@quentincaffeino
Copy link
Author

quentincaffeino commented Jun 13, 2020

Thanks, this works.
Still I'm not really sure that current behavior is intentional.
Fixed version: https://svelte.dev/repl/aa58fd54d0fd430489f1ef137020b539?version=3.23.0

UPD: now I think I better understand how it works and why it works like that, thanks.

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

2 participants