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

Svelte 5: $$slots is not defined if runes are used in the component #9683

Closed
scampos-s3d opened this issue Nov 28, 2023 · 2 comments · Fixed by #9718
Closed

Svelte 5: $$slots is not defined if runes are used in the component #9683

scampos-s3d opened this issue Nov 28, 2023 · 2 comments · Fixed by #9718
Milestone

Comments

@scampos-s3d
Copy link

scampos-s3d commented Nov 28, 2023

Describe the bug

When any kind of rune is used in a component, $$slots is not defined so cannot use {#if $$slots}
. Watching the js output seems like the line const $$slots = $.sanitize_slots($$props); is not created. Forcing it with {#if eval('unwrap($$props).children')} makes it work.

Reproduction

Repl

Logs

`$$slots is not defined`

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 30.37 GB / 63.93 GB
  Binaries:
    Node: 18.14.1 - C:\Program Files\nodejs\node.EXE
    npm: 9.3.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.2134.0), Chromium (119.0.2151.72)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    svelte: 5.0.0-next.14 => 5.0.0-next.14

Severity

blocking an upgrade

@scampos-s3d
Copy link
Author

I just didn't read the doc Snippets

@dummdidumm
Copy link
Member

Reopening - although snippets are the recommended way to do this in the future, $$slots should still be usable in runes mode.

@dummdidumm dummdidumm reopened this Nov 29, 2023
@dummdidumm dummdidumm added this to the 5.0 milestone Nov 29, 2023
dummdidumm added a commit that referenced this issue Nov 30, 2023
dummdidumm added a commit that referenced this issue Nov 30, 2023
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