Skip to content

Event when the slot changes from fallback to passed content #5304

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

Closed
icalvin102 opened this issue Aug 26, 2020 · 2 comments
Closed

Event when the slot changes from fallback to passed content #5304

icalvin102 opened this issue Aug 26, 2020 · 2 comments

Comments

@icalvin102
Copy link

icalvin102 commented Aug 26, 2020

As the title says: I'm searching for a event that triggers when the slot changes from fallback to passed content and vice versa.

https://svelte.dev/repl/d4c9910e42b045a6aabdd07eadbe8cb9?version=3.24.1

So I tried to build a hacky workaround (see link above) to pass a prop from a fallback component (onMount/dismount) to
the parent component with the slot.
But the problem with this script is that an {#if} block is seen as non-empty by the slot even though the condition is false
and no output is passed to the slot.

Is this by design or is this a bug?

And is there a way to get a event and/or state of a slot?

Thanks :)

@icalvin102 icalvin102 changed the title Component as fallback value of a slot is silently ignored Event when the slot changes from fallback to passed content Aug 26, 2020
@Conduitry
Copy link
Member

You should be able to use #4602 which is a recently added feature that we haven't gotten around to documenting yet.

@icalvin102
Copy link
Author

Thank you for your response. This is in theory what I was looking for.
However it lacks some important details for me. I illustrated the problem and feature request more in detail in #5312

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

No branches or pull requests

2 participants