diff --git a/app/store/mask.ts b/app/store/mask.ts index 105ca346..02132b77 100644 --- a/app/store/mask.ts +++ b/app/store/mask.ts @@ -109,7 +109,7 @@ export const useMaskStore = create()( }), { name: StoreKey.Mask, - version: 3, + version: 3.1, migrate(state, version) { const newState = JSON.parse(JSON.stringify(state)) as MaskState; @@ -119,6 +119,14 @@ export const useMaskStore = create()( Object.values(newState.masks).forEach((m) => (m.id = nanoid())); } + if (version < 3.1) { + const updatedMasks: Record = {}; + Object.values(newState.masks).forEach((m) => { + updatedMasks[m.id] = m; + }); + newState.masks = updatedMasks; + } + return newState as any; }, },