From 437586d92bdc6d413e325fb393c9ccfbaa041439 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 13 May 2017 22:22:04 +0430 Subject: [PATCH] [store] check if storeData.state is function for workaround --- lib/app/store.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/app/store.js b/lib/app/store.js index f3a5854949..c4f0ae7afc 100644 --- a/lib/app/store.js +++ b/lib/app/store.js @@ -33,10 +33,14 @@ for (let filename of filenames) { } // createStore -export const createStore = storeData === 'function' ? storeData : () => { - return new Vuex.Store(Object.assign({}, storeData, { - state: storeData.state() // Vuex Bug! - })) +export const createStore = storeData instanceof Function ? storeData : () => { + // Vuex Bug + if (storeData.state instanceof Function) { + return new Vuex.Store(Object.assign({}, storeData, { + state: storeData.state() + })) + } + return new Vuex.Store(storeData) } // Dynamically require module