Skip to content

Commit

Permalink
Fix: #6820 updating activeStep does not actually change the active st…
Browse files Browse the repository at this point in the history
…ep (#6841)

* useeffect for active step

* switched to use updateActiveStep and check for valid index
  • Loading branch information
PuppetFoam committed Jul 5, 2024
1 parent bed7552 commit 1c4f944
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/lib/stepper/Stepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { CSSTransition } from '../csstransition/CSSTransition';
import { useMergeProps, useMountEffect } from '../hooks/Hooks';
import { useMergeProps, useMountEffect, useUpdateEffect } from '../hooks/Hooks';
import { UniqueComponentId, classNames } from '../utils/Utils';
import { StepperBase } from './StepperBase';
import { StepperContent } from './StepperContent';
Expand All @@ -29,6 +29,12 @@ export const Stepper = React.memo(
}
});

useUpdateEffect(() => {
if (props.activeStep >= 0 && props.activeStep <= stepperPanels().length - 1) {
updateActiveStep(undefined, props.activeStep);
}
}, [props.activeStep]);

const getStepProp = (step, name) => {
return step?.props?.[name];
};
Expand Down

0 comments on commit 1c4f944

Please sign in to comment.