Context is no longer passed to slots under teleports after upgrade to alpha.170
Here is dropdown component
<self>
<button type="button" @click=show>
<slot>
if isShown?
<teleport to="#dropdown">
<slot name="dropdown">
Usage
<dropdown>
<span> "click me"
<div slot="dropdown">
<main-menu>
The main-menu component no longer accesses context in that case. It was working in alpha 167
Do you expect the main-menu #context to access properties on the dropdown, or the context in which it was created? Ie, do you want dropdown to be able to access #context.isShown?? I also need to rethink how events are supposed to flow via the teleport.
Previously we wrapped teleported elements in a teleporting container, which was helpful for inheriting styling and keeping track of the context, but it seems better to be able to move elements directly into their teleport if possible.
I think it makes sense for teleported children to be part of the flow of the tag that invoked the teleport (context, events ...). The main use cases for using teleport (modals, dropdowns, select menus ...) might need to use context data.
Accessing #context.isShown? seems not necessary. If I need it, I would pass it as a prop instead. In my case, I'm using context to access a property up in the tree currentPage
I'll add some more tests for this and fix it. One of the biggest shortcomings of imba now is the test-suite. It doesn't test any SSR rendering etc, pretty bad.
I'll add some more tests for this and fix it. One of the biggest shortcomings of imba now is the test-suite. It doesn't test any SSR rendering etc, pretty bad.
I could actually work on that. I will add an e2e test suite and I'll start with this issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
unmarking as stale, handy feature :)
Here is a scrim where it happens https://scrimba.com/scrim/c8GbkQfK