Open bencates opened 3 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug
When inserting two or more children into a named slot, SSR components will only insert the final child into the named slot. Any previous children are silently ignored.
DOM components support multiple children without issue, this only impacts the SSR build.
To Reproduce
Here's a small reproduction demo: https://svelte.dev/repl/d045f6b4265a4de4a08545cbba7def4f?version=3.31.0
Note that, as this is an SSR bug, the "Result" will render as expected. Select "JS output" and change
generate:
to"ssr"
and the issue is easily visible by inspecting the compiled code.Expected behavior
Both the DOM and the SSR builds insert all specified children into a named slot.
Severity
The direct effects are an annoyance; I was able to rework the components to not use named slots.
The second order effects were, in my case, a nontrivial percentage of the site being suddenly absent on deploy. I added a second child to a slot which had previously only had one, which unexpectedly replaced some links
sapper export
was relying on. The issue wasn't apparent in development because the DOM was repaired on hydration, I didn't notice it until I deployed to staging.Additional context
This came to my attention because
sapper export
wasn't discovering some links that I expected it to be able to see. Inspecting the generated HTML showed that it was missing a section of the DOM containing the links which was instead being created client-side during hydration. From there, it was straightforward to narrow down the source of the discrepancy.