Skip to content

Commit 9fa5a30

Browse files
[FIX] Issue-1171 Do not overwrite url derived state (#1186)
1 parent 39190d8 commit 9fa5a30

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

packages/spectacle/src/hooks/use-deck-state.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function deckReducer(state: DeckState, { type, payload = {} }: ReducerActions) {
100100
export default function useDeckState(userProvidedInitialState: DeckView) {
101101
const [{ initialized, pendingView, activeView }, dispatch] = useReducer(
102102
deckReducer,
103-
initialDeckState
103+
{ ...initialDeckState, ...userProvidedInitialState }
104104
);
105105
const actions = useMemo(
106106
() => ({
@@ -120,12 +120,6 @@ export default function useDeckState(userProvidedInitialState: DeckView) {
120120
[dispatch]
121121
);
122122

123-
useEffect(() => {
124-
if (initialized) return;
125-
if (userProvidedInitialState === undefined) return;
126-
actions.initializeTo(userProvidedInitialState);
127-
}, [initialized, actions, userProvidedInitialState]);
128-
129123
return {
130124
initialized,
131125
pendingView,

0 commit comments

Comments
 (0)