Treat verse 0 as an ordinary verse; remove liveScrRef stickiness guard#134
Treat verse 0 as an ordinary verse; remove liveScrRef stickiness guard#134alex-rawlings-yyc wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Devin has a bug and some flags on this pr: https://app.devin.ai/review/sillsdev/interlinearizer-extension/pull/134 |
8b4cc27 to
b7403fb
Compare
A chapter's pre-verse-1 superscription is a real, focusable verse-0 segment, but `liveScrRef` held a stickiness guard that swallowed any same-chapter `verseNum: 0` reference naming the verse already shown. That guard was added (b9dec18, "fix verse-0 echo nav") before verse 0 was a parsed verse, to absorb the host's spurious post-verse-nav chapter echo. It could not distinguish that echo from a genuine external `<` (previous-verse) from verse 1 — both are same-chapter, verse 0, and markerless on the global selector path — so it also ate the intentional `<`, leaving the extension stuck on verse 1 instead of moving to the superscription. Verified in a live session (probe logging liveScrRef/rawScrRef) that the host no longer emits the spurious echo: exactly one delivery per navigation, never an unsolicited trailing verse 0. With the echo gone the guard defended against nothing, so remove it. Verse 0 now passes through verbatim; the host's `<` from verse 1 lands on the chapter's superscription (the loader resolves verse 0 to the superscription segment, else to verse 1). The internal-nav marker machinery is retained — it still classifies internal/external navigations for the recenter fade. Only its former role inside the verse-0 guard is gone. Tests: collapse the two sticky-behavior tests into one pass-through regression test; flip the mid-reveal fade test to expect the curtain to re-engage for a verse-0 navigation arriving during fade-in (verse 0 is now an ordinary mid-reveal move). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b7403fb to
f223dbc
Compare
|
I want to test this behavior out in the Psalms before approving: src/components/InterlinearNavContext.tsx:248 |
|
The behavior is fine for me in the Psalms, so I think this is valid to act on: src/components/InterlinearNavContext.tsx:248 |
And perhaps see if a new test or two could target this regression concern. |
|
I believe the most recent commit suffices to simplify the logic. I had done a bit of testing on my own and found that the host was no longer sending echoes. I didn't tell you because I got distracted working on the other PR and I also wanted to see if you could find any issues with the host that I didn't see |
| // verse before rendering. The alias keeps the intent-revealing name and marks the seam where any | ||
| // future raw→active mapping would live; `rawScrRef` already reuses the previously committed object | ||
| // on a value-equal re-send, so a duplicate delivery never reads as a fresh navigation. | ||
| const liveScrRef = rawScrRef; |
There was a problem hiding this comment.
With the stickiness gone I think this can go one step further: stableRawScrRefRef and liveScrRefRef now hold the same object at every point they're read — both are set to the same object during render, and each is read before its own write. So the two refs can merge into one that serves both jobs (the duplicate-delivery identity guard and the mid-reveal prev comparison):
const prevScrRefRef = useRef<SerializedVerseRef>(hostScrRef);
const prevScrRef = prevScrRefRef.current;
const scrRef = areScrRefsEqual(hostScrRef, prevScrRef) ? prevScrRef : hostScrRef;
prevScrRefRef.current = scrRef;with the mid-reveal guard comparing liveKey !== verseKey(prevScrRef). Behavior is unchanged (first render, duplicate deliveries, and StrictMode double-render all read the same values as today).
On keeping the rawScrRef/liveScrRef pair for the seam: the loader's activeScrRef is now where the real raw→active mapping lives — and any such mapping needs the loaded book, which this layer explicitly doesn't have (as this field's own doc notes). So I'd collapse the interface to a single scrRef and reintroduce the split only if a book-independent mapping ever turns up. Not a blocker either way.
A chapter's pre-verse-1 superscription is a real, focusable verse-0 segment,
but
liveScrRefheld a stickiness guard that swallowed any same-chapterverseNum: 0reference naming the verse already shown. That guard was added(b9dec18, "fix verse-0 echo nav") before verse 0 was a parsed verse, to absorb
the host's spurious post-verse-nav chapter echo. It could not distinguish that
echo from a genuine external
<(previous-verse) from verse 1 — both aresame-chapter, verse 0, and markerless on the global selector path — so it also
ate the intentional
<, leaving the extension stuck on verse 1 instead ofmoving to the superscription.
Verified in a live session (probe logging liveScrRef/rawScrRef) that the host
no longer emits the spurious echo: exactly one delivery per navigation, never
an unsolicited trailing verse 0. With the echo gone the guard defended against
nothing, so remove it. Verse 0 now passes through verbatim; the host's
<fromverse 1 lands on the chapter's superscription (the loader resolves verse 0 to
the superscription segment, else to verse 1).
The internal-nav marker machinery is retained — it still classifies internal/external navigations for the recenter fade. Only its former role
inside the verse-0 guard is gone.
Tests: collapse the two sticky-behavior tests into one pass-through regression
test; flip the mid-reveal fade test to expect the curtain to re-engage for a
verse-0 navigation arriving during fade-in (verse 0 is now an ordinary mid-reveal move).
This change is
Summary by CodeRabbit
Documentation
Tests