diff --git a/src/screens/Home/Home.tsx b/src/screens/Home/Home.tsx index ece55761..2d713ef8 100644 --- a/src/screens/Home/Home.tsx +++ b/src/screens/Home/Home.tsx @@ -123,11 +123,11 @@ function Home({ navigation }: Props) { }); useEffect(() => { - if (newTx) { + if (newTx.rawTx) { handleTxRequest(newTx.rawTx, newTx.chain, newTx.path); clearTx?.(); } - }, [newTx]); + }, [newTx.rawTx]); const checkXpubXpriv = async () => { if (!xpubKey || !xprivKey) { diff --git a/src/store/flux/index.ts b/src/store/flux/index.ts index 2efc35e5..06d0aa6d 100644 --- a/src/store/flux/index.ts +++ b/src/store/flux/index.ts @@ -33,6 +33,7 @@ const fluxSlice = createSlice({ state, action: PayloadAction<{ wallet: string; data: string }>, ) => { + state.wallets = state.wallets || {}; state.wallets[action.payload.wallet] = state.wallets[ action.payload.wallet ] || { ...initialWalletState }; @@ -42,6 +43,7 @@ const fluxSlice = createSlice({ state, action: PayloadAction<{ wallet: string; data: string }>, ) => { + state.wallets = state.wallets || {}; state.wallets[action.payload.wallet] = state.wallets[ action.payload.wallet ] || { ...initialWalletState }; diff --git a/src/store/index.ts b/src/store/index.ts index f80b1e28..8b0638ff 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -11,6 +11,7 @@ import { REGISTER, Storage, } from 'redux-persist'; +import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2'; import { MMKV } from 'react-native-mmkv'; import theme from './theme'; @@ -42,9 +43,13 @@ export const reduxStorage: Storage = { const persistConfig = { key: 'root', storage: reduxStorage, + stateReconciler: autoMergeLevel2, }; -const persistedReducer = persistReducer(persistConfig, reducers); +const persistedReducer = persistReducer>( + persistConfig, + reducers, +); const store = configureStore({ reducer: persistedReducer,