-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Interactivity API: Fix reactivity of undefined objects and arrays added with deepMerge
#66183
Interactivity API: Fix reactivity of undefined objects and arrays added with deepMerge
#66183
Conversation
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. |
Flaky tests detected in ca60179. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11372332281
|
ca60179
to
bf38930
Compare
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.
This looks good to me. I would only update one of the tests as noted above.
On a somewhat related note: I would add some comments to the deepMergeRecursive()
implementation because it's a complex beast 😄 . I'll send a PR with this.
Great additions, @michalczaplinski. I'll merge them. ⭐ |
There was a conflict while trying to cherry-pick the commit to the wp/6.7 branch. Please resolve the conflict manually and create a PR to the wp/6.7 branch. PRs to wp/6.7 are similar to PRs to trunk, but you should base your PR on the wp/6.7 branch instead of trunk.
|
@DAreRodz It looks like this didn't cherry pick cleanly to the I will be cutting the packages for RC 1 on Monday morning UTC so the backport PR would need to land before then. Many thanks |
…ed with `deepMerge` (#66183) * Fix types in test * Add failing tests * Fix the bug * Update changelog * Fix changelog * Update tests Co-authored-by: DAreRodz <[email protected]> Co-authored-by: michalczaplinski <[email protected]>
…ed with `deepMerge` (#66183) (#66236) * Fix types in test * Add failing tests * Fix the bug * Update changelog * Fix changelog * Update tests Co-authored-by: DAreRodz <[email protected]> Co-authored-by: michalczaplinski <[email protected]>
…ed with `deepMerge` (#66183) * Fix types in test * Add failing tests * Fix the bug * Update changelog * Fix changelog * Update tests Co-authored-by: DAreRodz <[email protected]> Co-authored-by: michalczaplinski <[email protected]>
I just cherry-picked this PR to the release/19.5 branch to get it included in the next release: 8492898 |
…ed with `deepMerge` (WordPress#66183) * Fix types in test * Add failing tests * Fix the bug * Update changelog * Fix changelog * Update tests Co-authored-by: DAreRodz <[email protected]> Co-authored-by: michalczaplinski <[email protected]>
…outer Remove the workaround for a bug that was fixed in WordPress/gutenberg#66183. Previously, if the store was not initialized with a minimal navigation object, the interactivity-router script module would error. Props jonsurrell, czapla, gziolo. Fixes 62465#. git-svn-id: https://develop.svn.wordpress.org/trunk@59416 602fd350-edb4-49c9-b593-d223f7449a82
…outer Remove the workaround for a bug that was fixed in WordPress/gutenberg#66183. Previously, if the store was not initialized with a minimal navigation object, the interactivity-router script module would error. Props jonsurrell, czapla, gziolo. Fixes 62465#. Built from https://develop.svn.wordpress.org/trunk@59416 git-svn-id: http://core.svn.wordpress.org/trunk@58802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…outer Remove the workaround for a bug that was fixed in WordPress/gutenberg#66183. Previously, if the store was not initialized with a minimal navigation object, the interactivity-router script module would error. Props jonsurrell, czapla, gziolo. Fixes 62465#. Built from https://develop.svn.wordpress.org/trunk@59416 git-svn-id: https://core.svn.wordpress.org/trunk@58802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…outer. Remove the workaround for a bug that was fixed in WordPress/gutenberg#66183. Previously, if the store was not initialized with a minimal navigation object, the interactivity-router script module would error. Reviewed by desrosj. Merges [59416] to the 6.7 branch. Props jonsurrell, czapla, gziolo. Fixes #62465. git-svn-id: https://develop.svn.wordpress.org/branches/6.7@59436 602fd350-edb4-49c9-b593-d223f7449a82
…outer. Remove the workaround for a bug that was fixed in WordPress/gutenberg#66183. Previously, if the store was not initialized with a minimal navigation object, the interactivity-router script module would error. Reviewed by desrosj. Merges [59416] to the 6.7 branch. Props jonsurrell, czapla, gziolo. Fixes #62465. Built from https://develop.svn.wordpress.org/branches/6.7@59436 git-svn-id: http://core.svn.wordpress.org/branches/6.7@58822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Fixes a regression that breaks the reactivity of props from lazily instantiated objects/arrays inside the iAPI state or context.
The bug affects all directives reading properties from any lazily instantiated objects, e.g., those created by a module loaded asynchronously or during client-side navigation, impacting developers with such cases.
At this moment, it affects the loading bar that the
@wordpress/interactivity-router
module shows during navigations, which currently requires the following PHP code to work correctly (link), although it shouldn't be necessary:Props to @sirreal for pointing this out in sirreal/wordpress-develop#8.
Why?
The bug could affect developers whose blocks depend on lazily instantiated objects/arrays inside the iAPI state or context.
How?
This PR fixes the
deepMerge()
function, ensuring it "proxifies" newly created objects and arrays so they become "reactive".Testing Instructions
The following instructions should be followed in a WP instance where this lines are removed.
To reproduce the issue:
trunk
To ensure the issue is fixed: