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: Clear exit survey data #50765

Merged
merged 6 commits into from
Oct 17, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: make sure the data is cleared successfully before starting new flow
  • Loading branch information
truph01 committed Oct 16, 2024

Verified

This commit was signed with the committer’s verified signature.
BartoszGrajdek Bartosz Grajdek
commit beb9b1f61060ff5ff50bfc6b575647ad6d895be2
12 changes: 7 additions & 5 deletions src/libs/actions/ExitSurvey.ts
Original file line number Diff line number Diff line change
@@ -67,11 +67,13 @@ function switchToOldDot() {
/**
* Clear the exit survey form data.
*/
function resetExitSurveyForm() {
Onyx.set(ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM, null);
Onyx.set(ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM_DRAFT, null);
Onyx.set(ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM, null);
Onyx.set(ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM_DRAFT, null);
function resetExitSurveyForm(callback: () => void) {
Onyx.multiSet({
[ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM]: null,
[ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM_DRAFT]: null,
[ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM]: null,
[ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM_DRAFT]: null,
}).then(() => callback?.());
}

export {saveExitReason, saveResponse, switchToOldDot, resetExitSurveyForm};
5 changes: 1 addition & 4 deletions src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
import React, {useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react';
// eslint-disable-next-line no-restricted-imports
import type {GestureResponderEvent, ScrollView as RNScrollView, ScrollViewProps, StyleProp, ViewStyle} from 'react-native';
import {InteractionManager, NativeModules, View} from 'react-native';

Check failure on line 5 in src/pages/settings/InitialSettingsPage.tsx

GitHub Actions / Changed files ESLint check

'InteractionManager' is defined but never used
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import AccountSwitcher from '@components/AccountSwitcher';
@@ -239,10 +239,7 @@
}
: {
action() {
resetExitSurveyForm();
InteractionManager.runAfterInteractions(() => {
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON);
});
resetExitSurveyForm(() => Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON));
},
}),
},
Loading