diff --git a/lib/DevTools.js b/lib/DevTools.js index ecc615c80..2282c4aa9 100644 --- a/lib/DevTools.js +++ b/lib/DevTools.js @@ -1,4 +1,4 @@ -import {connectViaExtension, extractState} from 'remotedev'; +import {connectViaExtension} from 'remotedev'; import _ from 'underscore'; class DevTools { @@ -12,15 +12,10 @@ class DevTools { * @param {object} initialState - initial state of the storage * @param {onStateChange} onStateChange - callback which is triggered when we timetravel to a different registered action */ - constructor(initialState = {}, onStateChange = () => {}) { + constructor(initialState = {}) { this.state = initialState; - this.onStateChange = onStateChange; this.remotedev = connectViaExtension(); this.remotedev.init(this.state); - this.remotedev.subscribe((message) => { - const state = extractState(message); - this.onStateChange(state); - }); } /** diff --git a/lib/Onyx.js b/lib/Onyx.js index cc25ed6fd..1c51b8e6f 100644 --- a/lib/Onyx.js +++ b/lib/Onyx.js @@ -1144,27 +1144,7 @@ function initializeWithDefaultKeyStates(enableDevTools = false) { cache.merge(merged); _.each(merged, (val, key) => keyChanged(key, val)); if (enableDevTools) { - devTools = new DevTools(merged, (state) => { - Storage.getAllKeys().then((currentKeys) => { - const newState = state; - const newKeys = _.keys(state); - const removedKeys = _.without(_.values(currentKeys), newKeys); - - // Remove keys that dont exist in the new state - _.each(removedKeys, (value, key) => { - newState[key] = undefined; - }); - - // Update cache and optimistically inform subscribers on the next tick - _.each(newState, (value, key) => { - cache.set(key, value); - notifySubscribersOnNextTick(key, value); - }); - - // Update existing keys - Storage.multiSet(prepareKeyValuePairsForStorage(newState)); - }); - }); + devTools = new DevTools(merged); } }); }