From b475ae1d6617b7f1eec0072a51214360c81fb76b Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 22 Oct 2023 08:52:14 +0100 Subject: [PATCH] fix migration --- src/store/playerScoresStore.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/store/playerScoresStore.ts b/src/store/playerScoresStore.ts index 7d3eefb..61e84a7 100644 --- a/src/store/playerScoresStore.ts +++ b/src/store/playerScoresStore.ts @@ -232,11 +232,14 @@ export const usePlayerScoresStore = create()( migrate: (state: any, version: number) => { if (version == 1) { - console.log("Migrating player scores..."); - const players = state.players; - for (const player of players) { - player.scores = player.scores.scoresaber; - } + state.players = state.players.map((player: any) => { + return { + id: player.id, + scores: { + scoresaber: player.scores, + }, + }; + }); return state; }