mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-11 04:07:34 +03:00
Throw if there are more than one instrument enhancer included
This commit is contained in:
parent
a3d053880c
commit
e82ef7de59
|
@ -343,6 +343,10 @@ export default function instrument(monitorReducer = () => null) {
|
|||
}
|
||||
|
||||
const liftedStore = createStore(liftReducer(reducer), undefined, enhancer);
|
||||
if (liftedStore.liftedStore) {
|
||||
throw new Error('DevTools instrument shouldn\'t be included more than once. ' +
|
||||
'Check your store configuration.');
|
||||
}
|
||||
return unliftStore(liftedStore, liftReducer);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import expect, { spyOn } from 'expect';
|
||||
import { createStore } from 'redux';
|
||||
import { createStore, compose } from 'redux';
|
||||
import instrument, { ActionCreators } from '../src/instrument';
|
||||
|
||||
function counter(state = 0, action) {
|
||||
|
@ -328,4 +328,9 @@ describe('instrument', () => {
|
|||
instrument()(createStore)()
|
||||
).toThrow('Expected the nextReducer to be a function.');
|
||||
});
|
||||
it('throws if there are more than one instrument enhancer included', () => {
|
||||
expect(() => {
|
||||
store = createStore(counter, undefined, compose(instrument(), instrument()));
|
||||
}).toThrow('DevTools instrument shouldn\'t be included more than once. Check your store configuration.');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user