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 blocks in nested slots break the app #4703

Closed
christianheine opened this issue Apr 22, 2020 · 1 comment · Fixed by #4705
Closed

If blocks in nested slots break the app #4703

christianheine opened this issue Apr 22, 2020 · 1 comment · Fixed by #4705

Comments

@christianheine
Copy link
Contributor

Description
When using an if-block directly in a nested slot, it causes the app to break.

To Reproduce

Stack trace

VM260:541 Uncaught (in promise) ReferenceError: span is not defined
at Object.update [as p] (eval at handle_message (VM254 about:srcdoc:13), :541:21)
at Object.update [as p] (eval at handle_message (VM254 about:srcdoc:13), :597:35)
at Object.update [as p] (eval at handle_message (VM254 about:srcdoc:13), :428:21)
at update (eval at handle_message (VM254 about:srcdoc:13), :167:40)
at flush (eval at handle_message (VM254 about:srcdoc:13), :136:17)

Information about your Svelte project:

  • Your browser and the version: Chrome (latest)
  • OS X

Severity
Hard to judge. On the one hand, it breaks the app. But on the other hand, there is a straightforward workaround, so it can be easily mitigated: As soon as the if-block is contained in another element it works: https://svelte.dev/repl/803509fd37d3464c879e2af530db7ba1?version=3.20.1

Will break:

<Inner>
	<span slot="label">
		<slot>
			Click on the checkbox to break the app
			{#if showMore}
				more
			{/if}
		</slot>
	</span>
</Inner>

Will work:

<Inner>
	<span slot="label">
		<slot>
			<span>
				This one will not break
				{#if showMore}
					more
				{/if}
			</span>
		</slot>
	</span>
</Inner>
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