Skip to content

Commit 79f181c

Browse files
authored
fix(client): stop demo/RESET from wiping preferences and fix hidden-scenarios toggle
demo/RESET previously reinitialized the entire Redux tree, silently resetting dev/creator preferences (dark mode, hidden scenarios, revocation, showcase upload) back to defaults. Preserve the preferences slice across the reset instead. Also remove showHiddenScenarios from IntroductionPage's mount-only redirect/reset effect dependencies, since toggling the preference was re-triggering that effect and dispatching demo/RESET, undoing the toggle in the same tick. Signed-off-by: Emiliano Suñé <2395873+esune@users.noreply.github.com>
1 parent f037bec commit 79f181c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

frontend/src/client/pages/introduction/IntroductionPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export const IntroductionPage: React.FC = () => {
5757
dispatch(fetchAllShowcases())
5858
setMounted(true)
5959
}
60-
}, [dispatch, showHiddenScenarios])
60+
// Runs once on mount only; toggling showHiddenScenarios must not re-trigger this redirect/reset
61+
}, [dispatch])
6162

6263
useEffect(() => {
6364
trackPageView()

frontend/src/client/slices/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ const pReducer = (state: any, action: any) => {
4545
}
4646

4747
if (action.type === 'demo/RESET') {
48-
return rootReducer(undefined, action)
48+
// Reset demo progress, but keep dev/creator preferences (dark mode, hidden scenarios, etc.) intact
49+
return rootReducer({ preferences: restState.preferences }, action)
4950
}
5051

5152
return rootReducer(state === undefined ? undefined : restState, action)

0 commit comments

Comments
 (0)