[store] check if storeData.state is function for workaround

This commit is contained in:
Pooya Parsa 2017-05-13 22:22:04 +04:30
parent 05725d70e7
commit 437586d92b

View File

@ -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