From 6c3d69e9f8de3fd5c2434a43736678f0e2333b24 Mon Sep 17 00:00:00 2001 From: Pasindu Yeshan Date: Mon, 3 Aug 2026 18:24:43 +0530 Subject: [PATCH] Clear flow components and additional data on flow state reset clearFlowState nulled the executionId but left the rendered step in place, so a terminal failure kept a form that submits into a null executionId and a stale stepTimeout that could overwrite the real error with a timeout message. Components are only ever set together with a non-null executionId, so clear them together. Apply the whole reset synchronously, before the first await, so callers that do not await clearFlowState still complete it ahead of the setError that follows. --- .../src/components/presentation/auth/SignIn/SignIn.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react/src/components/presentation/auth/SignIn/SignIn.tsx b/packages/react/src/components/presentation/auth/SignIn/SignIn.tsx index aa23b812..c16f568a 100644 --- a/packages/react/src/components/presentation/auth/SignIn/SignIn.tsx +++ b/packages/react/src/components/presentation/auth/SignIn/SignIn.tsx @@ -321,9 +321,14 @@ const SignIn: FC = ({ * Clear all flow-related storage and state. */ const clearFlowState = async (): Promise => { + // Clear the expired flow state to prevent rendering a stale form with a null executionId. + // Kept before the first await so callers that do not await this function still apply the + // reset in one batch, ahead of the setError that follows. setExecutionId(null); - await setChallengeToken(null); + setComponents([]); + setAdditionalData({}); setIsFlowInitialized(false); + await setChallengeToken(null); try { const storageManager: any = await getStorageManager(); await storageManager?.removeHybridDataParameter?.('authId');