For WEB-3073, I ended up rewriting the way steps and validation fields are stored. Essentially, they were previously hard-coded, which made the approach of slicing away steps from various arrays to hide certain steps messy.
It wasn't a big deal when it was only a matter of hiding the calculator step, but with now having to hide 3 steps, and an individual field on the therapy settings step, it was not working well at all. Very flaky. Lots of bugs, and terrible performance when I finally got it almost working.
So I've made the form step generation dynamic, and removed the 'validationFields' array altogether by having the fields in small arrays within each defined substep. This means it all gets generated once, and there are no array-slicing gymnastics required, nor any more hard-coded 'step' paths, say, on the review step page when determining the step and substep indices for a given field for editing. It's all now able to be derived from the new 'formSteps' object.
One other note: I've added a skippedFields array prop to determine which fields to hide. Currently, the defaultProps for the component have them set to what's appropriate for the upcoming Palmtree study. Once we start running various 'types' of prescription flows at the same time (potentially even within the same clinic) we will need some sort of UI to specify this, but for now, it works, and should be easy enough to transpose this into a future UI.
WEB-3073 WEB-3074
For WEB-3073, I ended up rewriting the way steps and validation fields are stored. Essentially, they were previously hard-coded, which made the approach of slicing away steps from various arrays to hide certain steps messy.
It wasn't a big deal when it was only a matter of hiding the calculator step, but with now having to hide 3 steps, and an individual field on the therapy settings step, it was not working well at all. Very flaky. Lots of bugs, and terrible performance when I finally got it almost working.
So I've made the form step generation dynamic, and removed the 'validationFields' array altogether by having the fields in small arrays within each defined substep. This means it all gets generated once, and there are no array-slicing gymnastics required, nor any more hard-coded 'step' paths, say, on the review step page when determining the step and substep indices for a given field for editing. It's all now able to be derived from the new 'formSteps' object.
One other note: I've added a
skippedFields
array prop to determine which fields to hide. Currently, thedefaultProps
for the component have them set to what's appropriate for the upcoming Palmtree study. Once we start running various 'types' of prescription flows at the same time (potentially even within the same clinic) we will need some sort of UI to specify this, but for now, it works, and should be easy enough to transpose this into a future UI.