persisted plugins state
Summary: Two pros are passed into every plugin to persist state: - `this.props.persistedState` which is the object of the persisted state - `this.props.setPersistedState` which can be used to modify the persisted state The state itself is stored in redux and therefore persisted when switching plugins. The lifecycle hooks used a HOC are now implemented by the `ref`-function, which makes the code a little cleaner. Reviewed By: jknoxville Differential Revision: D8752097 fbshipit-source-id: d4f081f149cd840a29f1132bde91d72d3fba67ed
This commit is contained in:
committed by
Facebook Github Bot
parent
d0ecb46d64
commit
f5dcaf02a4
@@ -26,7 +26,10 @@ export default function reducer(
|
||||
if (action.type === 'SET_PLUGIN_STATE') {
|
||||
return {
|
||||
...state,
|
||||
[action.payload.pluginKey]: action.payload.state,
|
||||
[action.payload.pluginKey]: {
|
||||
...state[action.payload.pluginKey],
|
||||
...action.payload.state,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user