Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(receive): don't persist receive state #1198

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/navigation/bottom-sheet/ReceiveNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Tags from '../../screens/Wallets/Receive/Tags';
import { useSnapPoints } from '../../hooks/bottomSheet';
import { NavigationContainer } from '../../styles/components';
import { viewControllerIsOpenSelector } from '../../store/reselect/ui';
import { resetInvoice } from '../../store/actions/receive';
import { __E2E__ } from '../../constants/env';

export type ReceiveNavigationProp =
Expand All @@ -37,11 +38,16 @@ const ReceiveNavigation = (): ReactElement => {
viewControllerIsOpenSelector(state, 'receiveNavigation'),
);

const onOpen = (): void => {
resetInvoice();
};

return (
<BottomSheetWrapper
view="receiveNavigation"
snapPoints={snapPoints}
testID="ReceiveScreen">
testID="ReceiveScreen"
onOpen={onOpen}>
<NavigationContainer key={isOpen.toString()}>
<Stack.Navigator screenOptions={navOptions}>
<Stack.Screen name="ReceiveQR" component={ReceiveQR} />
Expand Down
2 changes: 0 additions & 2 deletions src/screens/Wallets/Receive/ReceiveQR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
ShareIcon,
} from '../../../styles/icons';
import { Caption13Up, Text02S } from '../../../styles/text';
import { resetInvoice } from '../../../store/actions/receive';
import { updateMetaIncTxTags } from '../../../store/actions/metadata';
import { createLightningInvoice } from '../../../store/actions/lightning';
import { generateNewReceiveAddress } from '../../../store/actions/wallet';
Expand Down Expand Up @@ -186,7 +185,6 @@ const ReceiveQR = ({
}
// Gives the modal animation time to start.
sleep(50).then(() => {
resetInvoice();
// Only refresh LDK if we have a remote balance.
if (lightningBalance.remoteBalance > 0) {
refreshLdk({ selectedWallet, selectedNetwork }).then();
Expand Down
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const persistConfig = {
// increase version after store shape changes
version: 15,
stateReconciler: autoMergeLevel2,
blacklist: ['ui'],
blacklist: ['receive', 'ui'],
migrate: createMigrate(migrations, { debug: __ENABLE_MIGRATION_DEBUG__ }),
};
const persistedReducer = persistReducer<RootReducer>(persistConfig, reducers);
Expand Down
2 changes: 2 additions & 0 deletions src/store/shapes/receive.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// NOTE: 'receive' reducer is not persisted to storage

import { IReceive } from '../types/receive';

export const defaultReceiveShape: IReceive = {
Expand Down
Loading