PT-2602: Main toolbar scroll group follows the active tab#2489
Closed
lyonsil wants to merge 1 commit into
Closed
Conversation
Building on #2478's versification-aware sync, the main toolbar adopts the active scripture tab's numbered scroll group and renders its BCV in that tab's versification (via the #2478 projectId), keeping the last group when the active tab has none. Adds a toolbar-internal useActiveTabScrollGroup hook that exposes the last active scripture tab's scroll group + project from window focus and the WebView definition (ignoring transient non-webview focus), deriving the active-tab definition synchronously so webViewId and its definition update in the same render. Includes the design spec and implementation plan. Treats a project-bound tab with no persisted scrollGroupScrRef as the default scroll group 0 (a freshly-opened reader/editor persists none until the user changes its group), so the toolbar recognizes it as attached and adopts its project for versification framing instead of falling back to the group's stored source. Non-project tabs and detached (object) refs stay unattached, so the toolbar keeps its last group. Also stops the scroll-group service from reprocessing its own platform.verseRef mirror echoes. Every group-0 verse change is mirrored out to that setting; when a toolbar navigation and the editor's scroll-settle write raced, a stale setting echo arrived after the stored ref had moved on and — carrying no source frame — cleared the known versification source, so followers stopped converting and both panels showed the same raw reference. The subscription now recognizes and skips the values it just mirrored, breaking the feedback loop; genuine external verseRef writers still flow through. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8KSmVvarWfKxtutZhpRyA
4b40d4d to
023790d
Compare
Member
Author
|
Done as part of #2519 |
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.
Summary
The main application toolbar's scroll group and Book/Chapter/Verse (BCV) control now follow the active (focused) scripture tab. Focus a tab synced to scroll group C and the toolbar switches to group C and shows that tab's reference — matching PT9's behavior. Previously the toolbar's scroll group was a standalone
localStoragevalue with no awareness of the active tab.Jira: PT-2602
Stacked on #2478 (please review that first)
This is based on
pt-4036-versification-aware-sync(#2478), notmain, because it depends on that PR's versification-awareuseScrollGroupScrRef. This PR therefore targetspt-4036-versification-aware-syncas its base so its diff shows only the PT-2602 changes. Once #2478 merges, this branch will be rebased ontomainand retargeted.The toolbar passes the active tab's
projectIdto #2478's versification-aware hook, so the toolbar BCV shows the identical reference the active tab shows, even across versification divergence points (Psalm headings, 3 John, etc.).Changes
src/renderer/components/use-active-tab-scroll-group.hook.ts— reads window focus (theplatform.windowServiceDataProviderFocustype) and the focused WebView's saved definition to expose the last active scripture tab's{ webViewId, scrollGroupId, projectId }, ignoring transient'other'/non-webview focus (keep-last). Not exported through any shared barrel.src/renderer/components/platform-bible-toolbar.tsx— a follow-effect (keyed on the active tab's identity) adopts the active tab's numbered scroll group; a smalleffectiveProjectIdderivation (attached → the active tab's project; otherwise the driven group's own source project) replaces thecurrentProject?.idargument PT-4036/PT-4037: versification-aware synchronized scrolling #2478 introduced.docs/superpowers/.Key design decisions (full rationale + PT9 source analysis in the spec)
AI Involvement
AI-assisted. The human developer (Matt Lyons) directed and reviewed every design decision. Workflow: collaborative brainstorming (including verifying the actual PT9 behavior against the Paratext 9 source), a written design spec, an implementation plan, then subagent-driven TDD implementation with an independent code review after each task and a whole-branch review before opening this PR. All code was human-reviewed. (Session link to be added.)
Testing
webViewId/group pairing on a tab switch).npm run typecheck/npm run lintclean for the changed files.Risk Level
Low — additive, renderer-only, display-follow behavior; no new services or cross-process contracts; backward compatible (the
platform-bible-toolbar.scrollGroupIdlocalStoragekey is retained); no write-back to WebView definitions.This change is