Allow passing optional afterLoad callbacks to store calls#53363
Allow passing optional afterLoad callbacks to store calls#53363
afterLoad callbacks to store calls#53363Conversation
32c396e to
9ca6552
Compare
|
@luisherranz ready for review ☝️ |
|
Size Change: +32 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
artemiomorales
left a comment
There was a problem hiding this comment.
Looks good to me!
|
Thanks, @artemiomorales. I'll wait for @luisherranz to take a look as well before merging. 😊 |
luisherranz
left a comment
There was a problem hiding this comment.
Codewise everything looks good. Great tests by the way 🙂
Would you mind adding a new section to the API reference to document the options argument and in there, the afterLoad option? It doesn't have to be extensive, we can improve it later, but at least we should mention it. Thanks!!
|
Flaky tests detected in 58447c8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5822624113
|
What?
Allow developers to pass callbacks to the Interactivity API
storefunction, e.g.,Why?
Some block types would need to initialize stuff in the global state, which might require the store to be ready.
How?
A
Setinstance stores all the passedafterLoadcallbacks to avoid duplicates. All registered callbacks run right after theinit()function, receiving the global store.Testing Instructions
It includes e2e tests that should pass.