diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 2a5baa81..bd98137a 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -27,5 +27,5 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - run: npm ci - - run: npx eslint . + - run: npm run lint - run: npm test diff --git a/redux/GamesSlice.ts b/redux/GamesSlice.ts index 4cc348bc..9e2218da 100644 --- a/redux/GamesSlice.ts +++ b/redux/GamesSlice.ts @@ -29,13 +29,16 @@ const gamesAdapter = createEntityAdapter({ }); const initialState = gamesAdapter.getInitialState({ +}); + +const gameDefaults = { roundCurrent: 0, roundTotal: 1, locked: false, sortSelectorKey: SortSelectorKey.ByScore, sortDirectionKey: SortDirectionKey.Normal, palette: 'original', -}); +}; const gamesSlice = createSlice({ name: 'games', @@ -143,11 +146,10 @@ export const asyncRematchGame = createAsyncThunk( }); dispatch(gameSave({ + ...gameDefaults, id: newGameId, title: game.title, dateCreated: Date.now(), - roundCurrent: 0, - roundTotal: 1, playerIds: playerIds, })); @@ -203,7 +205,7 @@ export const asyncCreateGame = createAsyncThunk( playerIds.push(Crypto.randomUUID()); } - const paletteName = initialState.palette; + const paletteName = gameDefaults.palette; const paletteColors = getPalette(paletteName); playerIds.forEach((playerId, index) => { @@ -217,7 +219,7 @@ export const asyncCreateGame = createAsyncThunk( }); dispatch(gameSave({ - ...initialState, + ...gameDefaults, id: newGameId, title: `Game ${gameCount + 1}`, dateCreated: Date.now(), diff --git a/redux/store.ts b/redux/store.ts index 951d3d70..d466c85e 100644 --- a/redux/store.ts +++ b/redux/store.ts @@ -31,7 +31,7 @@ const gamesPersistConfig = { key: 'games', version: 0, storage: AsyncStorage, - whitelist: ['entities', 'ids', 'sortSelectorKey'], + whitelist: ['entities', 'ids'], }; const playersPersistConfig = {