From 5faf60ba2a9b85be7358c42c3bec0638a23eff6d Mon Sep 17 00:00:00 2001 From: Ole Wieners Date: Wed, 14 Oct 2026 15:11:59 +0200 Subject: [PATCH] Fix `redux-persist` ignoring default values for new tables There was a bug where missing values for sort parameters of new tables where overriding the new default values. This fix is to change merging order, i.e. to make this work the other way around. This will only affect missing values, so actual stored values will still take precedence over the defaults. --- src/store.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/store.ts b/src/store.ts index 38b1b4a0f9..e1f0ba126b 100644 --- a/src/store.ts +++ b/src/store.ts @@ -42,7 +42,14 @@ const tableFilterProfilesPersistConfig = { key: "tableFilterProfiles", storage, const eventsPersistConfig = { key: "events", storage, whitelist: ["columns"] }; const seriesPersistConfig = { key: "series", storage, whitelist: ["columns"] }; const playlistPersistConfig = { key: "playlists", storage, whitelist: ["columns"] }; -const tablePersistConfig = { key: "table", storage, whitelist: ["pagination", "sortBy", "reverse"] }; +const tablePersistConfig = { + key: "table", + storage, + whitelist: ["pagination", "sortBy", "reverse"], + // Shallow merge persisted values into defaults, so resources added later still get their default sorting + // instead of `undefined:undefined` when the stored value was missing. + stateReconciler: autoMergeLevel2, +}; const recordingsPersistConfig = { key: "recordings", storage, whitelist: ["columns"] }; const jobsPersistConfig = { key: "jobs", storage, whitelist: ["columns"] }; const serversPersistConfig = { key: "servers", storage, whitelist: ["columns"] }; @@ -59,7 +66,7 @@ const reducers = combineReducers({ events: persistReducer(eventsPersistConfig, events), series: persistReducer(seriesPersistConfig, series), playlists: persistReducer(playlistPersistConfig, playlists), - table: persistReducer(tablePersistConfig, table), + table: persistReducer>(tablePersistConfig, table), recordings: persistReducer(recordingsPersistConfig, recordings), jobs: persistReducer(jobsPersistConfig, jobs), servers: persistReducer(serversPersistConfig, servers),