diff --git a/src/client/init.ts b/src/client/init.ts index 4d71ea819..8a0826732 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -103,9 +103,13 @@ document.body.innerHTML = '
'; const store = createStore(); +// 他のタブと永続化されたstateを同期 window.addEventListener('storage', e => { if (e.key === 'vuex') { - store.replaceState(JSON.parse(localStorage['vuex'])); + store.replaceState({ + ...store.state, + ...JSON.parse(e.newValue) + }); } else if (e.key === 'i') { location.reload(); }