-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: Only add proxies to plain objects inside the store #59039
Interactivity API: Only add proxies to plain objects inside the store #59039
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
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 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).