Description
This is a follow-up from #422 (comment)
The states that we have here [in
EditFreeCampaign
] essentially serve the same purpose as the form state, we can pull the<Form>
component up and wrap the stepper component (see setup ads flow for example reference), then we don't need to have these local states. It would help us save some unnecessary callbacks (i.e. we don't need to pass down thoseonSettingsChange
,onShippingRatesChange
andonShippingTimesChange
because they would all be in the form'sonChange
) and unnecessary re-renders.
Technical
We could make a code tad shorter and more readable if we move. We could make <Stepper>
Component inside <Form>
that would make all steps act as a single form. This should allow us to get rid of duplicated state management and unnecessary on*Change
callbacks and workarounds for unitialValues
.
Figma link
n/a
Acceptance criteria
- End-user behavior should not be impaired
- The end code should be shorter/easier to maintain and less redundant.
Unknowns
- We could make that change together with refactoring setup code to use shared component, to introduce it in both places at once, and to limit the amount of manual testing to avoid regression issues.
Out of bounds/rabbit holes
<Form>
component seems to be not well documented and tested, so we may end up using unmaintained features or rely on bugs as on features.
Event tracking
n/a