From bc1615f032186e88aebfa9dac38039dcff263162 Mon Sep 17 00:00:00 2001 From: kumavis Date: Thu, 12 Jan 2017 14:40:04 -0800 Subject: [PATCH] background - fix metamaskController store -> diskStore persistence --- app/scripts/background.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 0e5a76d51..1f269da7b 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -5,6 +5,7 @@ const asyncQ = require('async-q') const Migrator = require('./lib/migrator/') const migrations = require('./lib/migrations/') const LocalStorageStore = require('./lib/observable/local-storage') +const synchronizeStore = require('./lib/observable/util/sync') const PortStream = require('./lib/port-stream.js') const notification = require('./lib/notifications.js') const messageManager = require('./lib/message-manager') @@ -68,7 +69,11 @@ function setupController (initState) { global.metamaskController = controller // setup state persistence - controller.store.subscribe((newState) => diskStore) + synchronizeStore(controller.store, diskStore, (state) => { + let versionedData = diskStore.get() + versionedData.data = state + return versionedData + }) // // connect to other contexts