-
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
interface: migrate the toggleFeature action to a thunk #35075
Conversation
Size Change: -17 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
@jsnajdr, if I remember correctly, the current Persistence plugin doesn't work with Unfortunately, I don't have details on why it doesn't work. Just that I had this issue when implementing it for the new Navigation Screen. |
95155d4
to
a907540
Compare
Oh, I get it now! The Persistence plugin intercepts the Reverted the store registration back to |
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.
The changes look good 👍
Tested with Widgets screen welcome guide, where toggleFeature
is used for modal deactivation.
a907540
to
5655f67
Compare
Migrates the
@wordpress/interface
data store to thunks, removing usages of rungen generators.There is only the
toggleFeature
action that reads the current value of a feature and flips it -- taking defaults fromstate.preferenceDefaults
into account, and that's why the action can't be a plain action handled by a single reducer.As a drive-by fix, I'm converting
flow( [ combineReducers ] )( ... )
calls to a simplecombineReducers( ... )
-- there's no point in combining just a single function withflow
.I'm also changing how the store is registered. In #26655 @gziolo added a comment that says:
But I don't understand what it tries to say. Both the old
registerStore
and the newregister
do exactly the same sequence ofcreateReduxStore
,store.instantiate
andregisterGenericStore
calls, the newregister
version being much simpler. Maybe something was different back in November 2020?