-
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
Demo of new preferences package #38435
Conversation
9d2d3f7
to
02e759a
Compare
Size Change: +122 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
017a4e1
to
218fc49
Compare
export function* toggleFeature( scope, featureName ) { | ||
deprecated( `dispatch( 'core/interface' ).toggleFeature`, { | ||
since: '6.0', | ||
alternative: `dispatch( 'core/preferences' ).toggleFeature`, | ||
} ); | ||
|
||
yield controls.dispatch( | ||
preferencesStore.name, | ||
'toggleFeature', | ||
scope, | ||
featureName | ||
); | ||
} |
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'm not sure how far to go with deprecations for the interface package.
It is documented as an experimental package.
It doesn't seem possible to access it on the wp
global (wp.interface
), but the actions and selectors are all available via wp.data
, so I've chosen to deprecate those.
I've deleted the components completely from the package, but open to advice on whether I should also deprecate those.
d8bed6f
to
3e6cea3
Compare
f7b7323
to
50bfde1
Compare
So great to see your efforts to improve the way preferences are handled in Gutenberg. I appreciate you taking care of it, @talldan. Once your initial roadmap is materialized, we should revisit persisting user preferences on the server. There is some prior art in #19177. I think it's the most frustrating part of the experience to see the welcome guide every time the browser update happens or you open the editor on a different device. |
c82a557
to
9e050f6
Compare
cfba431
to
4ec19ab
Compare
4ec19ab
to
8ce31d6
Compare
Add initial README Add changelog Add store Update a few things Update edit-widgets to use preferences store Update customize-widgets to use preferences store Update edit-post to use preferences store Update e2e-tests to use preferences store Fixes to preferences Move components to preferences Fix package.json Fix classnames Fix exports Fix stylesheet imports Fix scss issues Fix code examples Update more menu component usage Fix e2e test selector Update package-lock file Re-update package-lock Are we nearly there yet Deprecate old selectors and actions and move tests over Update persisted data migration to migrate from interface Update comment Fix typo Flatten preference store state Fix test Fix tests again Fix persistence Remove useThunks property from preferences store config Simplify preferences store API Update preferences store usage for new api Add autogenerated API docs Update preferences README with new autogenerated API docs Move more menu back to the interface package Rename MoreMenuPreferenceToggle to PreferenceToggleMenuItem Add preference label to spoken message
8ce31d6
to
a1c200a
Compare
Closing this as most of the work has now been done in separate PRs. I'm keeping the tracking issue (#31965) up to date with progress. |
Description
Addresses some of #31965
This is a PR that demonstrates migrating what we call 'feature preferences' for each of our editors over to a single package. It should demonstrate everything working in the Post Editor, Widgets Editor and Customize Widgets Editor (the site editor will follow later). As this is quite a sizeable PR for review, I'll split this into separate pull requests in the following order:
@wordpress/preferences
package #38873After that:
Background
Previously each editor implemented its own preferences in the editor store, but this made it hard to share infrastructure between editors and didn't provide a foundation for cross-editor settings (#24370).
At the end of last year I move ahead with refactoring these preferences into the
interface
package, but then after further discussion a separatepreferences
package was proposed.