-
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
Plugins: Refactor the 'PluginArea' component to use the sync store #49220
Conversation
Size Change: -10 B (0%) Total Size: 1.34 MB
ℹ️ View Unchanged
|
Flaky tests detected in e34777f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4475841035
|
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.
Tests well and the code looks great 👍
🚀
setPlugins() { | ||
this.setState( this.getCurrentPluginsState ); | ||
} | ||
const plugins = useSyncExternalStore( store.subscribe, store.getValue ); |
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 think plugins
and store
could be abstracted to their own usePluginsState
hook. Not a huge deal of course, since it's used only in one place.
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 also thought about it. Let’s abstract when there’s another use for them.
What?
PR refactors the
PluginArea
component to use theuseSyncExternalStore
hook instead of lifecycle methods.Why?
Testing Instructions
Register testing plugin via console:
Screenshots or screencast