Skip to content

Commit

Permalink
throw before checking the status
Browse files Browse the repository at this point in the history
  • Loading branch information
w33ble committed Aug 25, 2016
1 parent 2c1ea3e commit f21054c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ui/public/state_management/state_monitor_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ function stateMonitor(state, customInitialState) {

return {
setInitialState(customInitialState) {
if (!isPlainObject(customInitialState)) throw new TypeError('The default state must be an object');

// check the current status
const previousStatus = getStatus();

// update the initialState and apply ignoredProps
if (!isPlainObject(customInitialState)) throw new TypeError('The default state must be an object');
setInitialState(customInitialState);
removeIgnoredProps(initialState);

Expand Down

0 comments on commit f21054c

Please sign in to comment.