Munchable's first run asks which gut conditions you are eating for, then tailors everything after that to the answer. Each condition it offers has a page of its own on the site, so you can see the list it is working from at munchable.app/conditions without installing anything.

The flow itself is one screen file. Not a stack, not a wizard library, not a route per step. Here is the whole of its navigation model:

const hasLactose = conditions.includes('lactose'); const steps = [ 'welcome', 'framing', 'region', 'conditions', ...(hasLactose ? ['lactose'] : []), 'allergies', 'healthy', 'done', ]; const [i, setI] = useState(0); const idx = Math.min(i, steps.length - 1); const step = steps[idx]; 

Seven steps, or eight if you tick one particular box. That spread is the interesting part, because steps is recomputed on every render from the answers you have given so far. You are not walking a fixed list. You are walking a list that your own answers rewrite underneath you.

Why a step appears at all

The inserted step asks one follow-up question: how much lactose you can usually handle. It only makes sense for somebody who said lactose is one of their conditions, and asking everybody else would be a dead screen with no useful answer in it.

The alternative designs were worse. A fixed list of eight with a skip means an extra render that exists to be invisible, and a progress indicator that lies. A nested sub-flow means a second navigation model for one question. Computing the list is two lines and the question simply is not there for people it does not apply to.

The index can outrun the list

A list whose length depends on state has a failure mode a fixed list does not: an index that was valid a render ago can point past the end. Hence the clamp:

const idx = Math.min(i, steps.length - 1); 

So I went looking for the route that actually produces that state, and could not find one open. The condition picker is the only screen that changes the length, it sits before the inserted step, and moving backwards to it is only possible while the back control is on screen:

{idx > 0 && idx < steps.length - 1 ? ( <Pressable onPress={() => setI(Math.max(0, idx - 1))} ...> 

The last step has no back control, which closes the one path that could leave i stranded past the new end of the list. The clamp is a guard for a state the interface no longer lets you reach. It is four tokens, it will survive the next person adding a step, and I am leaving it in. Worth knowing that it is defensive rather than load bearing, though, because a comment saying "needed, see bug" would have been wrong.

There is no form state

The thing I would actually defend in a review is what the steps write to. Every answer goes straight into the persisted device profile as you make it. The picker is wired directly to the store:

<MultiPicker items={CONDITION_PICKER_ITEMS} selected={conditions} onToggle={toggleCondition} ... /> 

toggleCondition is a store action, and the store persists to device storage. There is no draft object, no submit, no reducer holding a half-built profile, and nothing to reconcile at the end. The only thing the final screen does is flip one boolean:

const finish = () => { completeOnboarding(); router.replace('/'); }; 

Three consequences fall out of that, and the middle one took me by surprise:

  1. The "You're set" screen is not handed a summary. It reads the store and renders a chip per condition, so it cannot disagree with what was saved.
  2. Quit halfway through and relaunch, and the flow starts again at step one with every answer you already gave still selected. The steps are views over saved state, not pages of a form, so a restart is cheap and nothing is lost. What is lost is your position, which is the right thing to drop: it is the only part of the state nobody wanted.
  3. Because the step index is the only thing held in component state, there is nothing to migrate when the step list changes in a future release. Someone mid-onboarding during an update gets the new list and their old answers.

The other half of that choice is on the second screen, next to a padlock, in the one piece of copy that explains it: the answers are kept on the device. That claim is also written down in our privacy notice, which is the version a reader can hold us to, and it is why the next section is the ordering.

The account is asked for last

The app's entry route is a gate with the ordering written into it:

if (!onboarded) return <Redirect href="/onboarding" />; if (REQUIRE_ACCOUNT && !restored) return null; // wait for session restore if (REQUIRE_ACCOUNT && !account) return <Redirect href="/(auth)/sign-in" />; return <Redirect href="/home" />; 

Conditions first, sign-in second. Most products do this the other way around, because an account before the questionnaire is how the questionnaire ends up in your database. Ours cannot go there, so there is nothing to collect by asking early, and a sign-in wall in front of a stranger who has not yet seen what the app does is just a worse first screen.

The middle line matters too. While the stored session is still being restored the gate renders nothing rather than guessing, so nobody gets a flash of the sign-in screen before being sent to the home screen they were already entitled to.

What the flow is, in total

  • one screen file, 315 lines, eight step names in an array
  • one piece of component state, an integer
  • one derived list, recomputed per render
  • one clamp, defensive
  • one boolean written at the end
  • every other answer written at the moment it is given

If you want to see the questions this flow is asking, the conditions each have a page at munchable.app/conditions, and the long tail of per-ingredient answers those conditions drive is at munchable.app/answers. The homepage shows what the app looks like once the flow is done.