Skip to content

chore(ui): Add wizard steps to <ConfigureSSO />#8468

Open
LauraBeatris wants to merge 11 commits intomainfrom
laura/add-wizard-to-configure-sso
Open

chore(ui): Add wizard steps to <ConfigureSSO />#8468
LauraBeatris wants to merge 11 commits intomainfrom
laura/add-wizard-to-configure-sso

Conversation

@LauraBeatris
Copy link
Copy Markdown
Member

@LauraBeatris LauraBeatris commented May 4, 2026

Description

  • Introduces Wizard component with support for root and inner steps
  • Introduce basic boilerplate of modules per step
  • Add different Flow.Part per step type
  • Handles initial loading UI state when querying enterprise connections

To be handled in next PRs:

  • Whether a step is considered "complete" (green mark)
CleanShot.2026-05-05.at.00.18.48.mp4

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@LauraBeatris LauraBeatris self-assigned this May 4, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: a7f1340

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 5, 2026 11:11pm

Request Review

@github-actions github-actions Bot added the ui label May 4, 2026
@LauraBeatris LauraBeatris force-pushed the laura/add-configure-sso-component branch 6 times, most recently from 67fbe0d to bcc4254 Compare May 4, 2026 20:09
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from ff61174 to e8b8f9a Compare May 4, 2026 22:14
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from e8b8f9a to 18f5bfd Compare May 4, 2026 22:40
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from 7d5575c to 24fadad Compare May 5, 2026 01:01
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from 24fadad to e4b796e Compare May 5, 2026 01:04
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from e4b796e to 541f9aa Compare May 5, 2026 01:11
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from 541f9aa to b5e2c1a Compare May 5, 2026 01:14
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from b5e2c1a to 0caf48e Compare May 5, 2026 02:16
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from 0caf48e to 1db042b Compare May 5, 2026 02:20
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from 1db042b to 265c4b1 Compare May 5, 2026 02:28
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizardContext.tsx`:
- Around line 67-85: The WizardChromeProvider is mutating
stackRef/deepestWizardRef without updating context consumers; add a version
counter state (e.g., const [stackVersion, setStackVersion] = React.useState(0))
and increment it inside pushWizard and popWizard (call setStackVersion(s => s +
1)) after updating stackRef/deepestWizardRef, then include stackVersion in the
useMemo dependency array so the returned WizardChromeRegistry object changes and
consumers (like Footer reading deepestWizardRef.current) re-render when
registration state updates; keep existing names pushWizard, popWizard, stackRef,
deepestWizardRef, continueAction, setContinueAction and only change the provider
to bump version on mutations and add it to useMemo deps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 54f4da1f-99e0-4834-85d7-42ab603131db

📥 Commits

Reviewing files that changed from the base of the PR and between a64ba86 and 798ee78.

📒 Files selected for processing (6)
  • packages/clerk-js/src/core/clerk.ts
  • packages/ui/src/components/ConfigureSSO/ConfigureSSO.tsx
  • packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizard.tsx
  • packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizardContext.tsx
  • packages/ui/src/components/ConfigureSSO/wizard/index.ts
  • packages/ui/src/components/ConfigureSSO/wizard/types.ts

Comment on lines +67 to +85
export const WizardChromeProvider = ({ children }: { children: React.ReactNode }): JSX.Element => {
const [continueAction, setContinueAction] = React.useState<ContinueAction | undefined>(undefined);
const stackRef = React.useRef<WizardValueRef[]>([]);
const deepestWizardRef = React.useRef<WizardValueRef | undefined>(undefined);

const pushWizard = React.useCallback((ref: WizardValueRef) => {
stackRef.current = [...stackRef.current, ref];
deepestWizardRef.current = stackRef.current[stackRef.current.length - 1];
}, []);

const popWizard = React.useCallback((ref: WizardValueRef) => {
stackRef.current = stackRef.current.filter(r => r !== ref);
deepestWizardRef.current = stackRef.current[stackRef.current.length - 1];
}, []);

const value = React.useMemo<WizardChromeRegistry>(
() => ({ continueAction, setContinueAction, pushWizard, popWizard, deepestWizardRef }),
[continueAction, pushWizard, popWizard],
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Wizard registration path:"
rg -n -C2 'deepestWizardRef|pushWizard|popWizard|useRegisterWizard' packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizardContext.tsx

echo
echo "Footer render-time dependency on deepest wizard:"
rg -n -C2 'deepestWizardRef\.current|isFirstStep|isLastStep' packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizard.tsx

Repository: clerk/javascript

Length of output: 3104


Add a state trigger for wizard stack registration changes.

The wizard stack is tracked entirely in refs (stackRef, deepestWizardRef), but pushWizard/popWizard mutations don't notify context consumers. The Footer reads deepestWizardRef.current during render and defaults both step flags to true when undefined. On first mount, the Footer renders before the registration effect runs, leaving buttons disabled. After useRegisterWizard pushes the wizard to the stack, no re-render is triggered because the context value object remains unchanged—useMemo dependencies only include continueAction, pushWizard, and popWizard, not the stack state.

Include a version counter that bumps in pushWizard/popWizard and add it to the useMemo dependency array so the context value changes and subscribers re-render when registration completes.

Suggested fix
 export const WizardChromeProvider = ({ children }: { children: React.ReactNode }): JSX.Element => {
   const [continueAction, setContinueAction] = React.useState<ContinueAction | undefined>(undefined);
+  const [stackVersion, bumpStackVersion] = React.useReducer((x: number) => x + 1, 0);
   const stackRef = React.useRef<WizardValueRef[]>([]);
   const deepestWizardRef = React.useRef<WizardValueRef | undefined>(undefined);

   const pushWizard = React.useCallback((ref: WizardValueRef) => {
     stackRef.current = [...stackRef.current, ref];
     deepestWizardRef.current = stackRef.current[stackRef.current.length - 1];
+    bumpStackVersion();
   }, []);

   const popWizard = React.useCallback((ref: WizardValueRef) => {
     stackRef.current = stackRef.current.filter(r => r !== ref);
     deepestWizardRef.current = stackRef.current[stackRef.current.length - 1];
+    bumpStackVersion();
   }, []);

   const value = React.useMemo<WizardChromeRegistry>(
     () => ({ continueAction, setContinueAction, pushWizard, popWizard, deepestWizardRef }),
-    [continueAction, pushWizard, popWizard],
+    [continueAction, pushWizard, popWizard, stackVersion],
   );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizardContext.tsx`
around lines 67 - 85, The WizardChromeProvider is mutating
stackRef/deepestWizardRef without updating context consumers; add a version
counter state (e.g., const [stackVersion, setStackVersion] = React.useState(0))
and increment it inside pushWizard and popWizard (call setStackVersion(s => s +
1)) after updating stackRef/deepestWizardRef, then include stackVersion in the
useMemo dependency array so the returned WizardChromeRegistry object changes and
consumers (like Footer reading deepestWizardRef.current) re-render when
registration state updates; keep existing names pushWizard, popWizard, stackRef,
deepestWizardRef, continueAction, setContinueAction and only change the provider
to bump version on mutations and add it to useMemo deps.

@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from c0e5daf to aa04cf0 Compare May 5, 2026 21:16
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ui/src/components/ConfigureSSO/ConfigureSSO.tsx`:
- Line 1: The import line in ConfigureSSO.tsx duplicates useUser, causing an
import/no-duplicates lint error; edit the import statement `import {
__internal_useUserEnterpriseConnections, useOrganization, useUser, useUser }
from '@clerk/shared/react';` to remove the second `useUser` so each symbol is
only listed once (keep `__internal_useUserEnterpriseConnections`,
`useOrganization`, and `useUser`).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 57d13034-c273-46f4-8e70-b521d99cd2d8

📥 Commits

Reviewing files that changed from the base of the PR and between 798ee78 and c0e5daf.

📒 Files selected for processing (2)
  • packages/ui/src/components/ConfigureSSO/ConfigureSSO.tsx
  • packages/ui/src/components/ConfigureSSO/ConfigureSSOContext.tsx

Comment thread packages/ui/src/components/ConfigureSSO/ConfigureSSO.tsx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizard.tsx`:
- Around line 180-181: The isFirstStep and isLastStep flags in
ConfigureSSOWizard.tsx are incorrectly computed to force nested wizards to never
be absolute-first/last by ANDing with !parentWizard; update the logic so
isFirstStep becomes (index <= 0) and isLastStep becomes (index ===
activeSteps.length - 1) regardless of parentWizard, while preserving any
existing local/relative navigation behavior elsewhere; adjust any places that
relied on the old flags (e.g., footer/navigation render) to respect the absolute
boundary flags so Previous/Next become no-op-disabled at true first/last
positions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 4d798647-9ece-48ff-86be-e806b52877e1

📥 Commits

Reviewing files that changed from the base of the PR and between c0e5daf and aa04cf0.

📒 Files selected for processing (4)
  • packages/ui/src/components/ConfigureSSO/ConfigureSSO.tsx
  • packages/ui/src/components/ConfigureSSO/ConfigureSSOContext.tsx
  • packages/ui/src/components/ConfigureSSO/steps/index.ts
  • packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizard.tsx

Comment thread packages/ui/src/components/ConfigureSSO/wizard/ConfigureSSOWizard.tsx Outdated
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from aa04cf0 to 8c7e926 Compare May 5, 2026 21:46
@LauraBeatris LauraBeatris force-pushed the laura/add-wizard-to-configure-sso branch from 8c7e926 to 551b23a Compare May 5, 2026 21:47
return;
}

if (noUserExists(this)) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this one that got missed on the first PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants