Skip to content

fix(ui): retain highlight colors in usePassageStyle while dimmed (YPE-6539) - #302

Merged
camrun91 merged 4 commits into
mainfrom
t3/ype-6539-fix
Dec 4, 2026
Merged

camrun91 merged 4 commits into
mainfrom
t3/ype-6539-fix

Conversation

@camrun91

@camrun91 camrun91 commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Keep highlight fills on the dimmed outgoing chapter while the next chapter loads (YPE-6539). When navigation changes the chapter or reference, highlights switches immediately to the new scope while usePassage still renders the outgoing passage dimmed. usePassageStyle derived colors against the new scope and dropped the outgoing fills.

What changed

  • Added optional isCurrent (default true) to usePassageStyle in packages/ui/src/native/scripture/passage-style.ts.
  • Retained the last ServerColors per passage.key in state when isCurrent is true, and reused those colors when isCurrent is false for the same passage.key.
  • Passed isCurrent from BibleReaderNative and BibleTextViewNative.
  • Added failing-first regression tests in bible-reader-native.test.tsx and bible-text-view.test.tsx, plus hook tests in passage-style.test.tsx.
  • Added a patch changeset for @youversion/platform-react-native-expo-ui.

Scope

  • packages/ui/src/native/scripture/passage-style.ts
  • packages/ui/src/native/bible-reader-native.tsx
  • packages/ui/src/native/bible-text-view-native.tsx
  • packages/ui/src/native/__tests__/bible-reader-native.test.tsx
  • packages/ui/src/native/__tests__/bible-text-view.test.tsx
  • packages/ui/src/native/scripture/__tests__/passage-style.test.tsx
  • .changeset/ype-6539-dimmed-chapter-highlights.md

Tradeoffs

  • Retained ServerColors in React state during render instead of a ref because oxlint enforces react-hooks/refs.
  • Compared colors with sameColors (with an identity fast path) instead of identity alone because useHighlightPaint in BibleTextViewNative can return a fresh empty array on re-render.

Blast Radius

  • Only BibleReaderNative and BibleTextViewNative pass isCurrent. PassageEmbed keeps the default true because it swaps to a spinner instead of dimming stale passages.

Verification

  • pnpm --filter @youversion/platform-react-native-expo-ui test -- packages/ui/src/native/__tests__/bible-reader-native.test.tsx packages/ui/src/native/__tests__/bible-text-view.test.tsx packages/ui/src/native/scripture/__tests__/passage-style.test.tsx: 3 suites, 87 tests passed (the two new dimmed-transition tests failed before the fix).
  • pnpm --filter @youversion/platform-react-native-expo-ui test: full UI test suite passed.
  • CI=true pnpm typecheck: 5/5 tasks passed.
  • pnpm lint: 0 warnings, 0 errors.

Confidence Score: 5/5RetriggerView in Greptile

The PR appears safe to merge; no blocking issues remain.

Summary

Keeps saved highlight fills on outgoing passages while the next passage loads.

  • Dimmed passages keep their highlight fills while the next passage loads.

The earlier, unnumbered sign-out finding is fixed: changing the user prevents saved colors from being reused and clears them from state.

Reviews (3) · Last reviewed commit: "refactor(ui): flatten passage-style rete..." · Reviewed by Greptile

@Dustin-Kelley Dustin-Kelley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posted by Grok Bot on behalf of @Dustin-Kelley.

Looks ready: 0 blocking, 3 non-blocking. The fix covers both YPE-6539 acceptance points (dimmed outgoing chapter keeps its last fills, tested for Reader and BibleTextView), and the sign-out leak is fixed in caf40c3 with tests. The PR's 3 suites pass locally (92 tests) and CI is green.

@Dustin-Kelley Dustin-Kelley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works so i'm approving! You can decide if you wan't to do those nits

@camrun91
camrun91 merged commit 14fa8b4 into main Dec 4, 2026
12 checks passed
@camrun91
camrun91 deleted the t3/ype-6539-fix branch December 4, 2026 23:15
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.

2 participants