Fix stale Plan tab on plan switch; replace segmented toggle with title picker - #17
Merged
Merged
Conversation
…e picker
Bug fix: switching the active plan while the Plan tab stayed mounted
showed stale content — the previously active plan's day/chapter
breakdown kept rendering. Root cause: ChapterGroupList's <For> over
group names snapshotted each group's chapters into a plain `const`
before returning JSX. Day names ("Day 1", "Day 2", ...) are identical
across every plan, so <For> (keyed by value) never re-invoked that
callback on a plan switch, freezing the snapshot at whichever plan
was active on first render. Fix: do the props.data[groupName] lookup
inline in the JSX so it stays a reactive getter instead of a frozen
snapshot. (The underlying activePlanId/perDayTagData signal chain was
already correct — confirmed via instrumentation — only the rendered
output was stale.)
UX: replaced the segmented-control plan toggle with PlanPicker, an
iOS "tap the title to switch context" menu (the pattern Mail and
Reminders use for their inbox/list pickers). The segmented control
didn't scale past a couple of plans; this does, and only appears when
there's more than one plan to switch between.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2wCTwwVhhkSDxQxWo7UoH
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.
Bug fix
Switching the active plan while the Plan tab stayed mounted showed stale content — the previously active plan's day/chapter breakdown kept rendering instead of the newly selected plan's.
Root cause:
ChapterGroupList's<For>over group names snapshotted each group's chapters into a plainconst chapters = props.data[groupName]before returning JSX. Day names ("Day 1","Day 2", ...) are identical strings across every plan, so<For>— which is keyed by value — never re-invoked that callback on a plan switch. The snapshot froze at whichever plan was active on first render.I confirmed the underlying
activePlanId/perDayTagDatasignal chain was already firing correctly (instrumentedplanGroups'screateMemoand watched it recompute on every toggle) — only the rendered output was stale. The fix keeps theprops.data[groupName]lookup inline in the JSX instead of pre-computing it, so it compiles to a reactive getter rather than a frozen snapshot.UX change
Replaced the segmented-control plan toggle (from the previous PR) with
PlanPicker, an iOS "tap the title to switch context" menu — the pattern Mail and Reminders use for their inbox/list pickers. The segmented control didn't scale past a couple of plans (not enough horizontal room); this does, and it only appears once there's more than one plan to switch between.Test plan
npm run buildpassestsc --noEmitpassesGenesis 1-3, Matthew 1-2— after switching to a Genesis-only plan), confirmed the fix resolves it, and confirmed it round-trips cleanly switching back and forth several timesPlanPicker: hidden with one plan (shows plain "Plan" title), shows"{active plan name} ▾"with 2+ plans, opens a menu with a checkmark on the active plan, closes on selection or on an outside click, and correctly updates both the title and the rendered day content — tested with 5 plans to confirm it doesn't run into the segmented control's space problemGenerated by Claude Code