From 92a0977ae8a26ce730a5a93ac3113839d11f349b Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Wed, 12 Feb 2025 15:38:55 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Lock=20app=20in=20=E2=80=9Cloadi?=
=?UTF-8?q?ng=20state=E2=80=9D=20in=20last=20oauth=20stage?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A redirect happens, and the current page should stay locked preventing users from interacting with the wizard before the refresh is finished.
---
.../js/hooks/useHandleConnections.js | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/modules/ppcp-settings/resources/js/hooks/useHandleConnections.js b/modules/ppcp-settings/resources/js/hooks/useHandleConnections.js
index ce7f0e1e3..e605b61ef 100644
--- a/modules/ppcp-settings/resources/js/hooks/useHandleConnections.js
+++ b/modules/ppcp-settings/resources/js/hooks/useHandleConnections.js
@@ -30,7 +30,7 @@ export const useHandleOnboardingButton = ( isSandbox ) => {
const { sandboxOnboardingUrl } = CommonHooks.useSandbox();
const { productionOnboardingUrl } = CommonHooks.useProduction();
const products = OnboardingHooks.useDetermineProducts();
- const { withActivity } = CommonHooks.useBusyState();
+ const { withActivity, startActivity } = CommonHooks.useBusyState();
const { authenticateWithOAuth } = CommonHooks.useAuthentication();
const [ onboardingUrl, setOnboardingUrl ] = useState( '' );
const [ scriptLoaded, setScriptLoaded ] = useState( false );
@@ -110,16 +110,15 @@ export const useHandleOnboardingButton = ( isSandbox ) => {
* frame before the REST endpoint returns a value. Using "withActivity" is more of a
* visual cue to the user that something is still processing in the background.
*/
- await withActivity(
+ startActivity(
ACTIVITIES.OAUTH_VERIFY,
- 'Validating the connection details',
- async () => {
- await authenticateWithOAuth(
- sharedId,
- authCode,
- 'sandbox' === environment
- );
- }
+ 'Validating the connection details'
+ );
+
+ await authenticateWithOAuth(
+ sharedId,
+ authCode,
+ 'sandbox' === environment
);
};