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

If-elseif-else block not evaluating first if condition properly when using function, reactive value, and nested component #4840

Closed
paco3346 opened this issue May 15, 2020 · 1 comment · Fixed by #4841
Labels

Comments

@paco3346
Copy link

paco3346 commented May 15, 2020

Describe the bug
(Open my REPL link below. This will be way easier to follow)
When using an if,elseif,else statement where the first if uses a function, the second if uses a reactive value and the else block contains a component, the first if will always be evaluated as false.

  • If the first ifis changed to anything other than a function call it works as expected
  • If the second if is changed to anything other than a reactive value it works as expected
  • If the content in the else block does not contain a component, it works as expected

Logs
No errors reported

To Reproduce
https://svelte.dev/repl/775ab3e02b6c4ddd99e10ee0822e13b9?version=3

Expected behavior
The first if should evaluate based on the condition, not always be false.

Information about your Svelte project:

  • Your browser and the version: Chromium 81.0.4044.129
  • Your operating system: Arch Linux
  • Svelte version 3.20.1 - 3.22.2
  • Webpack, storyboard, @babel/preset-env (but note that since this happens in the REPL I don't think any of this is related)

Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Svelte entirely?

Annoying but easy to work around. Actually figuring out what was causing it was far more of a hassle than the fix. The hardest part is auditing other scenarios where this may come into play since it's not something you can really search for.

@paco3346
Copy link
Author

This seems loosely related to #4120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants