Skip to content

Commit

Permalink
Data: refuse to register an already registered store
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Mar 16, 2023
1 parent 43338de commit 3c41421
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/data/src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ export function createRegistry( storeConfigs = {}, parent = null ) {
* @param {Object} store Store instance object (getSelectors, getActions, subscribe).
*/
function registerStoreInstance( name, store ) {
if ( stores[ name ] ) {
throw new Error( 'duplicate store oh no' );
}

if ( typeof store.getSelectors !== 'function' ) {
throw new TypeError( 'store.getSelectors must be a function' );
}
Expand Down

0 comments on commit 3c41421

Please sign in to comment.