PT-4438: Bible Texts follows the displayed resource's versification - #2873
Draft
jolierabideau wants to merge 1 commit into
Draft
jolierabideau wants to merge 1 commit into
jolierabideau wants to merge 1 commit into
Conversation
The Bible Texts / Commentaries panel belongs to the container project — its web-view definition `projectId` reads that project's `platformScripture.referencedProjectsAndResources` list and its text-connection settings — but it renders a DIFFERENT project, the selected resource, which may use a different versification. It followed the scroll group via the `useWebViewScrollGroupScrRef` prop, which converts the reference into the web view's own (container-project) versification. So when the resource's versification differed from the container project's (e.g. a VUL-based resource), the panel showed the wrong verse, and a verse click here stamped the container project as the scroll group's source. Call `useScrollGroupScrRef` directly with the selected resource's `projectId` as the conversion frame instead, as the model-text panel already does (#2537): `scrRef` now comes back in the resource's versification, and a verse click stamps the resource as the scroll group's source (other web views then convert FROM it). The hook call moves below the selection region because `resourceProjectId` is derived there; both consumers of `scrRef` were already downstream of it. The container project's id stays load-bearing for the reference list, the text-connection settings and the picker, so making the definition `projectId` the displayed resource — the alternative considered — is not available here. This web view backs both the Bible Texts and Commentaries tabs (switched by the `resourceType` web-view state), so both follow versification now. Adds tests pinning the conversion frame: the resolved resource's project id is passed and the container's is not, and no frame is passed before a resource resolves or for a row with no local project yet. #2537 shipped without test coverage; this closes that gap on the ported side. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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 Bible Texts / Commentaries panel belongs to the container project — its web-view definition
projectIdreads that project'splatformScripture.referencedProjectsAndResourceslist and its text-connection settings — but it renders a different project: the selected resource, which may use a different versification.It followed the scroll group via the
useWebViewScrollGroupScrRefprop, which converts the reference into the web view's own (container-project) versification. So when the resource's versification differed from the container's (e.g. a VUL-based resource), the panel showed the wrong verse, and a verse click here stamped the container project as the scroll group's source.This ports the fix #2537 already applied to the model-text panel: call
useScrollGroupScrRefdirectly with the selected resource'sprojectIdas the conversion frame.scrRefnow comes back in the resource's versification, and a verse click stamps the resource as the scroll group's source (other web views then convert FROM it).Why review this
Part of the current epic — Sprint 89 Simple Quality, as a nice-to-have under PT-4420. Ian flagged it release-required on the ticket: "Of all the projects I've seen, very few were without some custom versification" — so the wrong-verse case is close to the common case rather than an edge case.
JIRA: PT-4438
Changes
resource-text-panel.web-view.tsx— swapuseWebViewScrollGroupScrRef()for a directuseScrollGroupScrRef(scrollGroupScrRef, …, resourceProjectId)call. The hook call moves below the selection region becauseresourceProjectIdis derived there; both consumers ofscrRef(theChapterUSJfetch and the render) were already downstream of it.resource-text-panel.web-view.test.tsx— tests pinning the conversion frame: the resolved resource's project id is passed and the container's is not; no frame before a resource resolves; no frame for a row with no local project yet. fix: model-text panel follows the model resource's versification #2537 shipped without test coverage, so this closes that gap on the ported side.resource-text-panel.component.tsx— one-word comment fix: a dependency-array rationale named the hook that no longer feeds that prop.Notes for the reviewer
Both tabs are affected. This web view backs Bible Texts and Commentaries (switched by the
resourceTypeweb-view state), so the fix lands for both. That is wider than the ticket title — worth exercising both tabs.TJ's structural alternative was considered and is not available here. Making the definition
projectIdbe "the project open in the WebView" would break the panel's three other uses of it:useEffectiveResourceReferenceList,textConnectionSettings, anduseResourcePickerResourcesall need the container project. That asymmetry is whyusePublishNavigableProjectIdsalready has to declare the resource id separately.Deliberately out of scope:
scripture-text-grid.web-view.tsxhas the same mismatch but renders several resources at once, so there is no single conversion frame. That is a design problem rather than a port, and may deserve its own ticket.AI Involvement
AI-assisted. The investigation, the fix, and the tests were generated by Claude Opus 5 in Claude Code and reviewed by me before commit. The commit carries a
Co-Authored-Bytrailer crediting the model as a generator; I remain the author.Testing
npm run typecheck— all four sub-checks exit 0npm run lint— 0 errors (1 pre-existing warning in an untouched file)prettier --checkclean on all changed filesRisk Level
Low — one hook call site in one web view, following a pattern already shipped and running in the model-text panel. The blast radius is the Bible Texts and Commentaries tabs; the behavior is unchanged whenever the resource and container project share a versification.
This change is