From 5b395200d60f82af6ec721b9cc32bf2051bcc09f Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 7 Jun 2024 11:27:11 +0200 Subject: [PATCH 1/3] make switchToOldDot return a promise --- src/libs/actions/ExitSurvey.ts | 2 +- .../ExitSurvey/ExitSurveyConfirmPage.tsx | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/ExitSurvey.ts b/src/libs/actions/ExitSurvey.ts index ef3ecd6d3e31..1687d037bc97 100644 --- a/src/libs/actions/ExitSurvey.ts +++ b/src/libs/actions/ExitSurvey.ts @@ -65,7 +65,7 @@ function switchToOldDot() { }, ]; - API.write( + return API.makeRequestWithSideEffects( 'SwitchToOldDot', { reason: exitReason, diff --git a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx index 7507e1015f86..a4ff01194cee 100644 --- a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx +++ b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx @@ -84,15 +84,14 @@ function ExitSurveyConfirmPage({exitReason, isLoading, route, navigation}: ExitS large text={translate('exitSurvey.goToExpensifyClassic')} onPress={() => { - ExitSurvey.switchToOldDot(); - - if (NativeModules.HybridAppModule) { - Navigation.resetToHome(); - NativeModules.HybridAppModule.closeReactNativeApp(); - return; - } - - Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX); + ExitSurvey.switchToOldDot().then(() => { + if (NativeModules.HybridAppModule) { + Navigation.resetToHome(); + NativeModules.HybridAppModule.closeReactNativeApp(); + return; + } + Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX); + }) }} isLoading={isLoading ?? false} isDisabled={isOffline} From a12b110f20777fb051cfcf7a3c2ad4107ca2334a Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 7 Jun 2024 15:10:36 +0200 Subject: [PATCH 2/3] add eslint ignore rule --- src/libs/actions/ExitSurvey.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/ExitSurvey.ts b/src/libs/actions/ExitSurvey.ts index 1687d037bc97..67ac39d81bd6 100644 --- a/src/libs/actions/ExitSurvey.ts +++ b/src/libs/actions/ExitSurvey.ts @@ -65,6 +65,7 @@ function switchToOldDot() { }, ]; + // eslint-disable-next-line rulesdir/no-api-side-effects-method return API.makeRequestWithSideEffects( 'SwitchToOldDot', { From 6ed95d1efd897481eb0299456374e79d44778fa4 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Fri, 7 Jun 2024 15:37:34 +0200 Subject: [PATCH 3/3] fix prettier --- src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx index a4ff01194cee..db9f3199954f 100644 --- a/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx +++ b/src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx @@ -91,7 +91,7 @@ function ExitSurveyConfirmPage({exitReason, isLoading, route, navigation}: ExitS return; } Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX); - }) + }); }} isLoading={isLoading ?? false} isDisabled={isOffline}