Skip to content

Commit

Permalink
fix: jumpstart intro should only be seen once (#6268)
Browse files Browse the repository at this point in the history
### Description

This PR fixes the jumpstart intro seen screen from being shown more than
once. The jumpstart slice was part of the redux persist blacklist, now
it is removed and the relevant state variables reset on rehydrate.

### Test plan

n/a

### Related issues

n/a

### Backwards compatibility

Y

### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- [ ] Continue to work without code changes, OR trigger a compilation
error (guaranteeing we find it when a new network is added)
  • Loading branch information
kathaypacific authored Dec 2, 2024
1 parent 295b9f5 commit 538a3d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
11 changes: 11 additions & 0 deletions src/jumpstart/slice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { PayloadAction, createSlice } from '@reduxjs/toolkit'
import { REHYDRATE, RehydrateAction } from 'redux-persist'
import { getRehydratePayload } from 'src/redux/persist-helper'
import { TokenBalance } from 'src/tokens/slice'
import { NetworkId, TokenAmount } from 'src/transactions/types'
import { SerializableTransactionRequest } from 'src/viem/preparedTransactionSerialization'
Expand Down Expand Up @@ -119,6 +121,15 @@ const slice = createSlice({
introHasBeenSeen: true,
}),
},
extraReducers: (builder) => {
builder.addCase(REHYDRATE, (state, action: RehydrateAction) => ({
...state,
...getRehydratePayload(action, 'jumpstart'),
claimStatus: 'idle',
depositStatus: 'idle',
reclaimStatus: 'idle',
}))
},
})

export const {
Expand Down
9 changes: 1 addition & 8 deletions src/redux/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ const persistConfig: PersistConfig<ReducersRootState> = {
version: 237,
keyPrefix: `reduxStore-`, // the redux-persist default is `persist:` which doesn't work with some file systems.
storage: FSStorage(),
blacklist: [
'networkInfo',
'alert',
'imports',
'keylessBackup',
'jumpstart',
transactionFeedV2Api.reducerPath,
],
blacklist: ['networkInfo', 'alert', 'imports', 'keylessBackup', transactionFeedV2Api.reducerPath],
stateReconciler: autoMergeLevel2,
migrate: async (...args) => {
const migrate = createMigrate(migrations)
Expand Down

0 comments on commit 538a3d9

Please sign in to comment.