From b532e629f364d90894da45f2a8f18aaeef4020a7 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 24 Sep 2021 10:08:23 +1000 Subject: [PATCH] grid, interface: fix localStorage versioning --- pkg/grid/src/state/base.ts | 5 ++--- pkg/interface/src/logic/state/base.ts | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/grid/src/state/base.ts b/pkg/grid/src/state/base.ts index ea47c14cd..78600dd01 100644 --- a/pkg/grid/src/state/base.ts +++ b/pkg/grid/src/state/base.ts @@ -74,7 +74,7 @@ export const optReduceState = , U>( export let stateStorageKeys: string[] = []; export const stateStorageKey = (stateName: string) => { - stateName = `Landscape${stateName}State`; + stateName = `Grid${stateName}State-${import.meta.env.VITE_SHORTHASH as any}`; stateStorageKeys = [...new Set([...stateStorageKeys, stateName])]; return stateName; }; @@ -149,8 +149,7 @@ export const createState = >( }), { blacklist, - name: stateStorageKey(name), - version: import.meta.env.VITE_SHORTHASH as any + name: stateStorageKey(name) } ) ); diff --git a/pkg/interface/src/logic/state/base.ts b/pkg/interface/src/logic/state/base.ts index 22f3ca43f..4787d3202 100644 --- a/pkg/interface/src/logic/state/base.ts +++ b/pkg/interface/src/logic/state/base.ts @@ -73,7 +73,7 @@ export const optReduceState = ( export let stateStorageKeys: string[] = []; export const stateStorageKey = (stateName: string) => { - stateName = `Landscape${stateName}State`; + stateName = `Landscape${stateName}State-${process.env.LANDSCAPE_SHORTHASH}`; stateStorageKeys = [...new Set([...stateStorageKeys, stateName])]; return stateName; }; @@ -140,8 +140,7 @@ export const createState = ( ...(typeof properties === 'function' ? (properties as any)(set, get) : properties) }), { blacklist, - name: stateStorageKey(name), - version: process.env.LANDSCAPE_SHORTHASH as any + name: stateStorageKey(name) })); export async function doOptimistically(state: UseStore>, action: A, call: (a: A) => Promise, reduce: ((a: A, fn: S & BaseState) => S & BaseState)[]) {