Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: defi only render current step if active #5476

Merged
merged 10 commits into from
Oct 18, 2023
5 changes: 3 additions & 2 deletions src/components/DeFi/components/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ export const Steps: React.FC<StepsProps> = ({
const Step = steps[step as DefiStep]
if (!Step) return null
const Component = Step.component
const isActive = currentStep === index
return (
<StepRow
label={Step.label}
key={step}
description={Step?.description}
stepNumber={`${index + 1}`}
isComplete={currentStep > index}
isActive={currentStep === index}
isActive={isActive}
>
<Component onNext={handleNext} {...Step.props} />
{isActive && <Component onNext={handleNext} {...Step.props} />}
</StepRow>
)
})}
Expand Down