@@ -55,6 +55,7 @@ function extractSteps(children: React.ReactNode): ConfigureSSOWizardActiveStep[]
5555 path : props . path ,
5656 label : props . label ,
5757 isCompleted : props . isCompleted ,
58+ hideFromBreadcrumb : props . hideFromBreadcrumb ,
5859 children : props . children ,
5960 } ) ;
6061 } ) ;
@@ -265,12 +266,16 @@ const StepBody = ({ step }: { step: ConfigureSSOWizardActiveStep }): JSX.Element
265266/**
266267 * Numbered breadcrumb of the outermost wizard's active steps.
267268 * Completed and current steps are clickable for backwards navigation,
268- * future steps are disabled
269+ * future steps are disabled. Steps marked with `hideFromBreadcrumb`
270+ * are silently skipped over and the visible steps are renumbered, so
271+ * dropping a hidden step from the wizard later doesn't shift numbers
269272 */
270273const Header = ( ) : JSX . Element => {
271274 const { activeSteps, currentIndex, isLoading, goToStep } = useConfigureSSOWizard ( ) ;
272275 const { t } = useLocalizations ( ) ;
273276
277+ const visibleSteps = React . useMemo ( ( ) => activeSteps . filter ( s => ! s . hideFromBreadcrumb ) , [ activeSteps ] ) ;
278+
274279 return (
275280 < Flex
276281 elementDescriptor = { descriptors . configureSSOWizardHeader }
@@ -284,10 +289,15 @@ const Header = (): JSX.Element => {
284289 flexWrap : 'wrap' ,
285290 } ) }
286291 >
287- { activeSteps . map ( ( step , index ) => {
288- const isCurrent = index === currentIndex ;
289- const isCompleted = step . isCompleted ?? index < currentIndex ;
290- const isReachable = isCompleted || index <= currentIndex ;
292+ { visibleSteps . map ( ( step , visibleIndex ) => {
293+ // `currentIndex` is computed against the full `activeSteps`
294+ // list, so look the visible step back up there to keep
295+ // current/completed/reachable consistent with the wizard's
296+ // own routing state
297+ const actualIndex = activeSteps . findIndex ( s => s . id === step . id ) ;
298+ const isCurrent = actualIndex === currentIndex ;
299+ const isCompleted = step . isCompleted ?? actualIndex < currentIndex ;
300+ const isReachable = isCompleted || actualIndex <= currentIndex ;
291301 const labelText = step . label ? ( typeof step . label === 'string' ? step . label : t ( step . label ) ) : '' ;
292302
293303 return (
@@ -342,7 +352,7 @@ const Header = (): JSX.Element => {
342352 size = 'xs'
343353 />
344354 ) : (
345- index + 1
355+ visibleIndex + 1
346356 ) }
347357 </ Flex >
348358 < Text
@@ -356,7 +366,7 @@ const Header = (): JSX.Element => {
356366 </ Text >
357367 </ Button >
358368 ) }
359- { index < activeSteps . length - 1 && (
369+ { visibleIndex < visibleSteps . length - 1 && (
360370 < Icon
361371 elementDescriptor = { descriptors . configureSSOWizardHeaderSeparator }
362372 icon = { CaretRight }
0 commit comments