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 |
Mamaduka
left a comment
There was a problem hiding this comment.
The changes look good 👍
Tested with Widgets screen welcome guide, where toggleFeature is used for modal deactivation.
a907540 to
5655f67
Compare
Migrates the
@wordpress/interfacedata store to thunks, removing usages of rungen generators.There is only the
toggleFeatureaction that reads the current value of a feature and flips it -- taking defaults fromstate.preferenceDefaultsinto 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
registerStoreand the newregisterdo exactly the same sequence ofcreateReduxStore,store.instantiateandregisterGenericStorecalls, the newregisterversion being much simpler. Maybe something was different back in November 2020?