-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
<slot slot="…"> (for passing slots through to child components) silently fails #2079
Comments
Turns out my workaround doesn’t work properly either: when you try to fill the passed-through slot, reactivity stops working. Demo updated to demonstrate this. So it looks as though passing slots through to child components is just completely broken in mostly invisible ways at present. |
Updated REPL — this now works, though Relatedly it would be useful to be able to 'forward' slots including unknown ones (so that the |
Would love to see passthrough slots to create superset components, for example Table and TableWithPagination (table slots for TableWithPagination could be passed through to Table). |
In 3.29.0 you can now use |
edit: so it's only for un-named slots? Is it really working? can someone share a working REPL ? |
@Conduitry still not working in ver 3.29.0. |
Yes @zeng450026937 we have an other error related this #5475 Thanks |
Pending @damianpumar's fix, you might try <slot slot="x" name="x" |
Good morning @arackaf yes, I pushed my fix here #5536 if you want, I can add a test to verify this. Many thanks! |
Using this broke the building process completely and silently, even in REPL: https://svelte.dev/repl/27483a5fc4064f4bb8f3584528d53655?version=3.29.0 Spent half of an hour to find out why the Rollup stopped building an app, no errors occurred and it's the most |
This issue was fixed by me 3 days ago here #5536 and it was added to 3.29.1 milestone Thanks! |
Should the following work for propagating nested slots back up? <slot slot="item" name="item" let:label let:item {label} {item} /> I get "cannot find" errors for |
This technically "works", but it breaks components that style differently using
I don't see a way around this at the moment, should I make a new issue? |
I think I have the same issue as you. I'm using slots like so:
Then I have a modal than contains a card like so:
When I use the Modal without header or footer slots, the Card header/footer areas are still shown. |
@endigma I've been able to fix this by changing the card component like so:
|
Demo: https://v3.svelte.technology/repl?version=3.0.0-beta.3&gist=853e7d404576d323ca476f7db99ee3d0
It’s reasonable to want to pass a slot through to a child component; the natural way to do this without adding a new DOM node is like this:
Unfortunately, this doesn’t work, and silently does doesn’t render the slot.
The current workaround is the same as for using components as a slot: create a regular DOM element and use that as the slot:
Vaguely related to #1037/#1713 which are about
slot
not yet working on components (it currently explicitly fails at compile time with a helpful message, which is a much happier failure mode).The text was updated successfully, but these errors were encountered: