Skip to content

Commit

Permalink
Fix form
Browse files Browse the repository at this point in the history
  • Loading branch information
nkhristinin committed May 24, 2022
1 parent 6cbba3a commit df0b7bb
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ const CreateRulePageComponent: React.FC = () => {
});
return null;
}

const isShouldRerenderStep = (step: RuleStep) => (activeStep !== step ? '0' : '1');

return (
<>
<SecuritySolutionPageWrapper>
Expand Down Expand Up @@ -330,6 +333,7 @@ const CreateRulePageComponent: React.FC = () => {
setForm={setFormHook}
onSubmit={submitStepDefineRule}
descriptionColumns="singleSplit"
key={isShouldRerenderStep(RuleStep.defineRule)}
/>
</EuiAccordion>
</MyEuiPanel>
Expand Down Expand Up @@ -365,6 +369,7 @@ const CreateRulePageComponent: React.FC = () => {
isLoading={isLoading || loading}
setForm={setFormHook}
onSubmit={() => submitStep(RuleStep.aboutRule)}
key={isShouldRerenderStep(RuleStep.aboutRule)}
/>
</EuiAccordion>
</MyEuiPanel>
Expand Down Expand Up @@ -399,6 +404,7 @@ const CreateRulePageComponent: React.FC = () => {
isLoading={isLoading || loading}
setForm={setFormHook}
onSubmit={() => submitStep(RuleStep.scheduleRule)}
key={isShouldRerenderStep(RuleStep.scheduleRule)}
/>
</EuiAccordion>
</MyEuiPanel>
Expand Down Expand Up @@ -432,6 +438,7 @@ const CreateRulePageComponent: React.FC = () => {
setForm={setFormHook}
onSubmit={() => submitStep(RuleStep.ruleActions)}
actionMessageParams={actionMessageParams}
key={isShouldRerenderStep(RuleStep.ruleActions)}
/>
</EuiAccordion>
</MyEuiPanel>
Expand Down

0 comments on commit df0b7bb

Please sign in to comment.