-
-
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
Slotted content less reactive when referencing external slot props in event handler #7440
Comments
You can workaround this by
Edit: I think svelte should dirty check by default if a slot's let bindings are referenced by inner slots' function scopes, e.g. event handlers. This would lead to more correct code(IINW) and better compiler output than above approaches. |
Hi @brunnerh. I'm noticing a couple of things here (and I'm rather new to Svelte, so forgive me if some of my comments are in error).
|
@brandonmcconnell The I know the slot props can be declared on the component, but slot props may not necessarily be available on every slot and the component already has a property called |
This should be fixed in 3.48.0 - https://svelte.dev/repl/6e71c6198e044697b577f36a29a0c507?version=3.48.0 |
Thanks, @Conduitry. Another issue was recently opened which may be related, where slot prop contents returned by the default slot renders as undefined when passed into named slots: Not sure if that should be working or not, but currently Svelte allows passing props into technically-neighboring slots without throwing any errors, but the value passed is undefined. 2 REPL examples of this behavior:
|
Describe the bug
This is a very specific issue which only seems to happen when passing slot props into content slotted into another component, only using them in an event handler.
E.g.
If the the
content
is additionally used in any other way, e.g. JSON stringified in the button content, the problem disappears.Reproduction
REPL
The edit buttons are supposed to initialize an edit dialog with the current state of the item, that being whether it is checked.
So if an item is initially unchecked, the edit dialog should also have an unchecked checkbox. Is this changed and the dialog is opened again, the box should now be checked.
Concrete steps:
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: