-
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
Introduce withSyncEvent
action wrapper utility and proxy event
object whenever it is not used
#68097
base: trunk
Are you sure you want to change the base?
Conversation
Flaky tests detected in dad7083. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12589925664
|
I don't know the codebase, but you are on track as much as I understand the changes and their implications. Thank you for continuing to work on it. I also wanted to share that it might not be easy to get more feedback in the next 2-3 weeks as many folks, myself included, take longer holiday breaks 🎉 |
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 gave it an initial review and so far it's looking good. The approach of splitting evaluate
into 2 functions seems sound to me. I see that you haven't implemented the proxying yet, so I'm happy to take another look once that's closer to being ready.
PS. The Interactivity API is almost entirely tested using the e2e suite in test/e2e/specs/interactivity/
. For this PR, you'll probably need to modify some of the existing "test" blocks like packages/e2e-tests/plugins/interactive-blocks/directive-on/view.js
or create a new "test" block in that folder.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
I have implemented the event proxying logic. For now, I'm warning about accessing the following without
As discussed on the issue, there may be more properties and methods to warn about, but we could always expand later. I think these 4 are a good starting point and should cover what's most common. Keep in mind that for now there is only a warning, but no functional behavior change. We can only yield before all callbacks that aren't using Review much appreciated! |
This implements the 1st step from #64944. Please see the issue for additional context on the rationale and overarching approach for this.
Relevant technical choices
evaluate
function resolves the entry into the relevant data, but then also immediately evaluates it.evaluate
function will not only "look up" the callback, but also call it.event
object based on whether the callback is wrapped inwithSyncEvent
prior to calling the callback, theevaluate
function is not sufficient.splitTask()
before running the callback function (see 2nd step from IntroducewithSyncEvent
and require Interactivity API actions that use theevent
object to use it #64944).resolveEntry
andevaluateResolved
. If they are called right after each other, it's effectively the same asevaluate
. In fact, this PR updatesevaluate
to rely on these two lower-level functions, to avoid duplicate code.evaluate
as is, which is more ergonomic. However theon
(but noton-async
) directives require the more granular access of the callback first, to only execute it later.Work in progress, but early reviews are appreciated.
So far, I have not implemented the actual proxying yet. I would like to get a sense of whether this minor expansion of the Interactivity API infrastructure makes sense before continuing.