Skip to content

Commit aa4d14b

Browse files
committed
fix: replace awaiting-input state on each state event
State events are complete snapshots: the server omits fields/choices when the current step has none, so retaining the prior values leaks a previous step's inputs (e.g. login SSO buttons rendering on the MFA step).
1 parent a59c8d1 commit aa4d14b

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎packages/managed-auth-react/src/session/useManagedAuthSession.ts‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ function mergeStateEvent(
6464
flow_status: ev.flow_status,
6565
flow_step: ev.flow_step,
6666
flow_type: ev.flow_type ?? base.flow_type ?? null,
67-
fields: ev.fields ?? base.fields ?? null,
68-
choices: ev.choices ?? base.choices ?? null,
69-
discovered_fields: ev.discovered_fields ?? base.discovered_fields ?? null,
70-
pending_sso_buttons:
71-
ev.pending_sso_buttons ?? base.pending_sso_buttons ?? null,
72-
mfa_options: ev.mfa_options ?? base.mfa_options ?? null,
73-
sign_in_options: ev.sign_in_options ?? base.sign_in_options ?? null,
67+
// State events carry a complete snapshot of the awaiting-input state:
68+
// the server omits fields/choices when the current step has none, so an
69+
// absent key means "cleared", not "unchanged". Falling back to the prior
70+
// state here leaks a previous step's inputs (e.g. login SSO buttons
71+
// rendering on the MFA step).
72+
fields: ev.fields ?? null,
73+
choices: ev.choices ?? null,
74+
discovered_fields: ev.discovered_fields ?? null,
75+
pending_sso_buttons: ev.pending_sso_buttons ?? null,
76+
mfa_options: ev.mfa_options ?? null,
77+
sign_in_options: ev.sign_in_options ?? null,
7478
external_action_message: ev.external_action_message ?? null,
7579
website_error: ev.website_error ?? null,
7680
error_message: ev.error_message ?? null,

0 commit comments

Comments
 (0)