-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add filter delegation #90
Conversation
🦋 Changeset detectedLatest commit: e95ab99 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✔️ Deploy Preview for interactors canceled. 🔨 Explore the source changes: e95ab99 🔍 Inspect the deploy log: https://app.netlify.com/sites/interactors/deploys/616ff78b1e9808000734e7dc |
0be575b
to
6947a4c
Compare
A filter can be delegated to another interactor, in this way we don't have to endlessly repeat fitler definitions, and we can compose interactor filters with each other.
6947a4c
to
e95ab99
Compare
.filters({
open: Calendar().exists(),
month: Calendar().find(Header()).text(),
}) This looks mind-blowingly good. |
68f7af2
to
e95ab99
Compare
How do we handle "portals" "wormholes" or other techniques to render "pseudo-children" where visually and in the component tree, the child is associated with the parent, but in the DOM, it is in a completely separate tree? In these cases, we want to break context and escape to the top of the page. |
You can use the .filters({
contextMenu: Page.find(ContextMenu())
}) |
A problem we've had with writing interactors is that filters do not compose in any meaningful way. Often we want to have a filter depend on another interactor to create better encapsulation. With filter delegation, building on filter methods introduced in #89, we can elegantly compose interactor filters.
An example:
In the future we may want to add support for delegated locators as well, but this is not included as part of this PR.
Depends on #89