Skip to content

Commit

Permalink
Data: Fix deprecation key to persist
Browse files Browse the repository at this point in the history
1. Wrong property accessed used
2. Reducer is already wrapped at point registerStore is called. Detect from plugin instead.
  • Loading branch information
aduth committed Aug 3, 2018
1 parent 94a1f4c commit 8f8c544
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 9 additions & 0 deletions packages/data/src/plugins/persistence/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ export default function( registry, pluginOptions ) {

return {
registerStore( reducerKey, options ) {
// REMOVEME: Deprecation: v3.7
if ( options.reducer.__deprecatedKeyToPersist ) {
options = {
...options,
persist: [ options.reducer.__deprecatedKeyToPersist ],
};
delete options.reducer.__deprecatedKeyToPersist;
}

if ( ! options.persist ) {
return registry.registerStore( reducerKey, options );
}
Expand Down
5 changes: 0 additions & 5 deletions packages/data/src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,6 @@ export function createRegistry( storeConfigs = {} ) {
throw new TypeError( 'Must specify store reducer' );
}

// REMOVEME: Deprecation: v3.7
if ( options.reducer.__keyToPersist ) {
options.persist = [ options.reducer.__keyToPersist ];
}

const store = registerReducer( reducerKey, options.reducer );

if ( options.actions ) {
Expand Down

0 comments on commit 8f8c544

Please sign in to comment.