From 9a1be27e597275f58aadd5a92cd589a56572bf83 Mon Sep 17 00:00:00 2001 From: Benoit Schweblin Date: Sat, 23 Dec 2017 23:08:21 +0100 Subject: [PATCH] Fixed undefined data --- src/store/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/data.js b/src/store/data.js index 37695b5b..d16c70a4 100644 --- a/src/store/data.js +++ b/src/store/data.js @@ -33,7 +33,7 @@ const lsItemIdSet = new Set(utils.localStorageDataIds); // Getter/setter/patcher factories const getter = id => state => ((lsItemIdSet.has(id) ? state.lsItemMap - : state.itemMap)[id] || empty(id)).data; + : state.itemMap)[id] || {}).data || empty(id).data; const setter = id => ({ commit }, data) => commit('setItem', itemTemplate(id, data)); const patcher = id => ({ state, commit }, data) => { const item = Object.assign(empty(id), (lsItemIdSet.has(id) @@ -118,7 +118,7 @@ export default { }, getters: { workspaces: (state, getters, rootState, rootGetters) => { - const workspaces = (state.lsItemMap.workspaces || empty('workspaces')).data; + const workspaces = (state.lsItemMap.workspaces || {}).data || empty('workspaces').data; const sanitizedWorkspaces = {}; const mainWorkspaceToken = rootGetters['workspace/mainWorkspaceToken']; Object.entries(workspaces).forEach(([id, workspace]) => {