Skip to content

PT-4438: Bible Texts follows the displayed resource's versification - #2873

Draft
jolierabideau wants to merge 1 commit into
mainfrom
pt-4438-bible-texts-follows-versification
Draft

jolierabideau wants to merge 1 commit into
mainfrom
pt-4438-bible-texts-follows-versification

Conversation

@jolierabideau

@jolierabideau jolierabideau commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

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'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 useScrollGroupScrRef directly with the selected resource's projectId as the conversion frame. 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).

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 — swap useWebViewScrollGroupScrRef() for a direct useScrollGroupScrRef(scrollGroupScrRef, …, resourceProjectId) call. The hook call moves below the selection region because resourceProjectId is derived there; both consumers of scrRef (the ChapterUSJ fetch 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 resourceType web-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 projectId be "the project open in the WebView" would break the panel's three other uses of it: useEffectiveResourceReferenceList, textConnectionSettings, and useResourcePickerResources all need the container project. That asymmetry is why usePublishNavigableProjectIds already has to declare the resource id separately.

Deliberately out of scope: scripture-text-grid.web-view.tsx has 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-By trailer crediting the model as a generator; I remain the author.

Testing

  • Full TypeScript suite green across all workspaces (0 failures)
  • npm run typecheck — all four sub-checks exit 0
  • npm run lint — 0 errors (1 pre-existing warning in an untouched file)
  • prettier --check clean on all changed files
  • Red/green confirmed: the three new tests fail against the un-fixed web view and pass with it
  • Manual verification on a packaged build against projects with differing versification — per PT-4420's "same bar as an NN" condition

Risk 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 Reviewable

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant