Interactivity API: Only add proxies to plain objects inside the store#59039
Interactivity API: Only add proxies to plain objects inside the store#59039cbravobernal merged 6 commits intotrunkfrom
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 2185920. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7976098141
|
7a8902e to
2280d68
Compare
DAreRodz
left a comment
There was a problem hiding this comment.
I have simplified the code a bit and added a simple test with @c4rl0sbr4v0.
LGTM!
PS: Adding more tests related to the store would be great. We can do that in another PR, sooner than later.
|
Size Change: -104 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
…#59039) * Only proxify plain objects * Do not support objects without prototypes * Rename store-tag to interactivity-data * Add test for non-plain objects in state * Update `isObject` implementation * Update changelog --------- Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org> Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
…#59039) * Only proxify plain objects * Do not support objects without prototypes * Rename store-tag to interactivity-data * Add test for non-plain objects in state * Update `isObject` implementation * Update changelog --------- Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org> Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
What?
Refactor the isObject function to only accept plain objects as stores.
Why?
Before this PR, the code was only checking with
typeof. In JavaScript, almost everything is an Object. We want to make sure that only plain objects are proxified. (Proxify means to add a getter that handles the namespace of the block/plugin and the Scope).