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

Conditional slot errors at runtime #849

Closed
mrkishi opened this issue Sep 16, 2017 · 2 comments · Fixed by #852
Closed

Conditional slot errors at runtime #849

mrkishi opened this issue Sep 16, 2017 · 2 comments · Fixed by #852

Comments

@mrkishi
Copy link
Member

mrkishi commented Sep 16, 2017

Slot content added inside an if currently fails at runtime:
https://svelte.technology/repl?version=1.39.2&gist=d4a50532f6a783ada53f35a2b9a7f9e4

This can be easily fixed by moving the condition inside the slot:
https://svelte.technology/repl?version=1.39.2&gist=3bf75a560243feecdeaca013a0e7ad26

I don't know if it makes sense to allow slots inside conditionals, but if not, Svelte could at least error on their usage.

@Rich-Harris
Copy link
Member

Thanks. I concluded that it's a bit too fiddly to allow slot='...' inside if/each blocks, so as of 1.39.3 this will cause a compile time error:

screen shot 2017-09-16 at 2 55 51 pm

@mrkishi
Copy link
Member Author

mrkishi commented Sep 16, 2017

You really are unstoppable. 🥇

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

Successfully merging a pull request may close this issue.

2 participants