-
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
Improve the Interactivity API priority levels logic #52323
Conversation
Co-authored-by: David Arenas <david.arenas@automattic.com>
Size Change: +928 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Flaky tests detected in 228a940. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5621696014
|
@DAreRodz and I have spent more time on this. We're going to leave the The logic was mostly working, tho. We just have to create new references for the const NextDirectives = useMemo(() => {
const Comp = Directives.bind();
Comp.displayName = `Directives - ${Object.keys(
thisPriorityLevel
).join(", ")}`;
return Comp;
}, []);
// ...
const children =
restPriorityLevels.length > 0 ? (
<NextDirectives
// ... We still need to do it for the root |
This should be ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a great refactoring (given that I have contributed, haha 😅). Approved! ✅
PS: This is just nitpicking; I would have changed thisPriorityLevel
with currentPriorityLevel
, and restPriorityLevel
with nextPriorityLevel
. As the Directive
component is iterating through all the priority levels, I feel those names are easier to understand. But there's not need to change them―it's just a feeling. 🤷
I like that. I'll change it before merging. |
If I'm not mistaken, |
What?
@DAreRodz and I have been trying to improve the logic of the priority levels implementation.
Why?
Because we wanted to remove the
Directive
top-level component and leave only components for each priority level and also improve the overall logic:Directive
component.ref
(it's broken now).Directives
component if none of the directives present in the element are registered.See ifcloneElement
is still necessary.See if the recursiveness can be absorbed in theoptions.vnode
hook. Not important unless we can reduce the code size.We left these tasks for later:
Directives: bind, class
.How?
So far, we moved the
Directive
component logic to theoptions.vnode
hook. We still need to fix theref
, but the tests are passing (we need tests that break theref
, probably withwp-show
).