File tree Expand file tree Collapse file tree
packages/ui/src/components/ConfigureSSO Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,24 +100,33 @@ export const ConfigureSSOContent = ({ contentRef }: { contentRef: React.RefObjec
100100} ;
101101
102102const ConfigureSSOSteps = ( ) => {
103- const { initialStepId } = useConfigureSSO ( ) ;
103+ const { initialStepId, enterpriseConnection } = useConfigureSSO ( ) ;
104104
105105 return (
106106 < Wizard initialStepId = { initialStepId } >
107107 < ResetCardErrorOnStepChange />
108108 < ConfigureSSOHeader />
109109
110+ { /*
111+ * `select-provider` is only a wizard step while there's no enterprise
112+ * connection yet — creating one unregisters this step, which:
113+ * 1. Hides it from the breadcrumb (no need for a manual filter), and
114+ * 2. Prevents `goPrev` from any later step (e.g. configure's first
115+ * substep) from ever bubbling back into provider selection.
116+ */ }
117+ { ! enterpriseConnection && (
118+ < Wizard . Step id = 'select-provider' >
119+ < SelectProviderStep />
120+ </ Wizard . Step >
121+ ) }
122+
110123 < Wizard . Step
111124 id = 'verify-domain'
112125 label = 'Verify domain'
113126 >
114127 < VerifyDomainStep />
115128 </ Wizard . Step >
116129
117- < Wizard . Step id = 'select-provider' >
118- < SelectProviderStep />
119- </ Wizard . Step >
120-
121130 < Wizard . Step
122131 id = 'configure'
123132 label = 'Configure'
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ import { useWizard } from './elements/Wizard';
77export const ConfigureSSOHeader = ( ) : JSX . Element => {
88 const { activeSteps, currentStep, goToStep } = useWizard ( ) ;
99 const { t } = useLocalizations ( ) ;
10- // Select Provider isn't part of the visual breadcrumb per the design —
11- // filter it out here. The wizard still tracks it as the first step
12- // for navigation (goNext from it advances to verify-domain, Previous
13- // is naturally disabled because isFirstStep is true).
10+
11+ // `select-provider` is only mounted while there's no enterprise connection,
12+ // but per design it should never appear in the visual breadcrumb regardless,
13+ // so we always filter it out here
1414 const visibleSteps = activeSteps . filter ( step => step . id !== 'select-provider' ) ;
1515 const currentIndex = visibleSteps . findIndex ( step => step . id === currentStep ?. id ) ;
1616
Original file line number Diff line number Diff line change @@ -12,7 +12,11 @@ export const deriveInitialStep = (
1212) : WizardStepId => {
1313 const { isDomainTakenByOtherOrg, hasSuccessfulTestRun } = options ;
1414
15- if ( isDomainTakenByOtherOrg || ! enterpriseConnection ) {
15+ if ( ! enterpriseConnection ) {
16+ return 'select-provider' ;
17+ }
18+
19+ if ( isDomainTakenByOtherOrg ) {
1620 return 'verify-domain' ;
1721 }
1822
Original file line number Diff line number Diff line change @@ -42,8 +42,12 @@ const PROVIDER_GROUPS: ReadonlyArray<{
4242
4343export const SelectProviderStep = ( ) : JSX . Element => {
4444 const { goToStep } = useWizard ( ) ;
45- const { setProvider, createEnterpriseConnection } = useConfigureSSO ( ) ;
46- const [ selected , setSelected ] = React . useState < ProviderType | null > ( null ) ;
45+ const { provider, setProvider, createEnterpriseConnection } = useConfigureSSO ( ) ;
46+
47+ // Re-hydrate from context so users returning from `verify-domain`
48+ // (after picking a provider but needing to verify their email first)
49+ // don't have to re-click their provider.
50+ const [ selected , setSelected ] = React . useState < ProviderType | null > ( provider ?? null ) ;
4751 const { user } = useUser ( ) ;
4852 const card = useCardState ( ) ;
4953
You can’t perform that action at this time.
0 commit comments