fix(console): the guide comes back when the last face is deleted - #178
Merged
Conversation
Reported a minute before it would have bitten: "will now delete everything to see the guided flow". Deleting your last face left you on a map with nothing to draw and no way back but a page reload, because guide-or-map was decided once when the pane first loaded. That decision was itself a fix — deriving it from `faces === 0` on every render flipped to the map the instant step two created a face, past step three, which is the step the whole guide leads to. So the rule needs both directions and now has three terms: showsGuide = !skipped && (guiding || faces === 0) `guiding` holds the guide open once it is showing, which is what step two needs. `skipped` is sticky for the session, because a holder who said they would build it themselves must not be dropped back into the guide by deleting a face — a thing they may well do next. And `faces` is nullable: not loaded is not zero, or the guide flashes at every holder on every load. It lives in `persona-flow.ts` rather than beside the guide, because the guide is `.tsx` and Node's type stripping cannot load JSX — and this rule has now been wrong twice, in opposite directions, so it needed to be somewhere a test can reach. Seven tests, mutation-checked against both historical versions: deciding once fails two of them, deriving from faces alone fails another. Neither failure looks like a wrong boolean. Both look like a broken page, which is why this is a function and not three terms inline. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caught a minute before it would have bitten, from "will now delete everything to see the guided flow" — which is the first thing anyone does with this pane, and it did not work.
The bug
Deleting your last face left you on the identity map with nothing to draw, and no way back to the guided setup short of reloading the page. Guide-or-map was decided once, when the pane first loaded.
Why it was decided once
Because the naive version is wrong in the other direction. Deriving from
faces === 0on every render flips to the map the instant step two creates a face — past step three, which is the step the whole guide leads to. That one was caught by reading the code in #176; this one needed a person about to use it.So the rule needs both directions, and now has three terms:
guidingholds the guide open once it is showing — what step two needs.skippedis sticky for the session: a holder who said they would build it themselves must not be dropped back into the guide by deleting a face, which is a thing they may well do next.facesis nullable, and not loaded is not zero — otherwise the guide flashes at every holder on every load and is yanked away, which is the worst possible first impression of the pane.Where it lives
persona-flow.ts, a plain module, rather than beside the guide it governs — the guide is.tsxand Node's type stripping cannot load JSX, which is whyprofile-entries.tsandidentity-graph.tsare.tstoo.Seven tests, mutation-checked against both historical versions: reverting to "decide once" fails two of them (a holder with no face is guided, deleting the last face brings the guide back), and reverting to "derive from faces alone" fails another (the guide survives its own second step creating a face).
Neither failure looks like a wrong boolean. Both look like a broken page — which is the argument for it being a tested function rather than three terms inline.
Verification
npm run lint,npm run build,npm test— 843 across four workspaces (+7). All sixci.ymlassertions against the real build.