-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Description
Describe the bug
When using the {@render} tag with snippets derived from dynamic variables (like $props or $state), the snippets are always rendered even when the variable is null or undefined. This causes unexpected behavior and potential errors in the application, as empty snippets are being rendered instead of being ignored.
When a snippet is null, undefined or empty (''), the {@render} tag should not attempt to render it, similar to how other reactive values work in Svelte. The documentation suggests using optional chaining {@render snippet?.()} as a workaround, but this should be the default behavior.
Reproduction
https://svelte.dev/playground/8540ec1eccfa4f259e12cc2e4b8af602?version=5.24.1
Logs
System Info
System:
OS: macOS 15.3.2
CPU: (10) arm64 Apple M1 Max
Memory: 1.10 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.18.0 - /opt/homebrew/bin/node
Yarn: 1.22.22 - ~/.npm-global/bin/yarn
npm: 9.9.4 - ~/Work/surveyplanet/svelte_components/node_modules/.bin/npm
Browsers:
Chrome: 134.0.6998.118
Edge: 134.0.3124.68
Safari: 18.3.1
npmPackages:
svelte: ^5.20.5 => 5.20.5Severity
annoyance
oyejorge and bartosjiri
Metadata
Metadata
Assignees
Labels
No labels