Skip to content

Commit

Permalink
fix(protocol-designer): refine logic for persisted state (#17142)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader authored Dec 18, 2024
1 parent f38bb0b commit aa57afc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions protocol-designer/src/analytics/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface OptInState {
hasOptedIn: boolean
appVersion?: string
}
const optInInitialState = {
const optInInitialState: OptInState = {
hasOptedIn: true,
}

Expand All @@ -23,7 +23,11 @@ const hasOptedIn: Reducer<OptInState, any> = handleActions(
action: RehydratePersistedAction
) => {
const persistedState = action.payload?.['analytics.hasOptedIn']
return persistedState !== undefined ? persistedState : optInInitialState
if (persistedState == null || persistedState?.hasOptedIn == null) {
return optInInitialState
} else {
return persistedState
}
},
},
optInInitialState
Expand Down

0 comments on commit aa57afc

Please sign in to comment.