From 8db364748b31b7cd67b7b9ee80a749ac9c51f87d Mon Sep 17 00:00:00 2001 From: Alexander Bentkamp Date: Mon, 2 Oct 2023 22:23:55 +0200 Subject: [PATCH] fix data undefined issue --- client/src/state/progress.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/state/progress.ts b/client/src/state/progress.ts index 1f11ae7..f553159 100644 --- a/client/src/state/progress.ts +++ b/client/src/state/progress.ts @@ -55,6 +55,9 @@ function addGameProgress (state: ProgressState, action: PayloadAction<{game: str if (!state.games[action.payload.game]) { state.games[action.payload.game] = {inventory: [], openedIntro: true, data: {}, difficulty: DEFAULT_DIFFICULTY} } + if (!state.games[action.payload.game].data) { + state.games[action.payload.game].data = {} + } } /** Add an empty skeleton with progress for the current level */