Skip to content

Release v0.9.0 — zero-latency verse tooltips via server-side hydration - #22

Open
onetogregorio wants to merge 1 commit into
mainfrom
release/v0.9.0
Open

Release v0.9.0 — zero-latency verse tooltips via server-side hydration#22
onetogregorio wants to merge 1 commit into
mainfrom
release/v0.9.0

Conversation

@onetogregorio

Copy link
Copy Markdown
Contributor

Summary

Builds on the newest Midvash Bible API capabilities (verified live against production before coding):

  • Zero-latency tooltips. The references detected while parsing the_content are now resolved server-side at render time in a single cache-aware /v1/passages call (batch limit raised to 50) and inlined into the page as a small hydration map (~2 KB for a typical post). The tooltip script seeds its cache from it, so the first hover of the first visitor opens instantly with no network request at all. The 0.8.0 client-side batch prefetch stays as a safety net for render-time upstream misses.
  • Lean chapter payloads. Whole-chapter references (Psalms 119…) no longer inline hundreds of verses: passages are trimmed at a verse-friendly cut with an ellipsis and a truncated flag, bulky verses[] arrays are dropped from the inline map, and "Read more" links to the full chapter. Full payloads remain in the server-side transient cache.
  • Chapter shape fix. The API's chapter payloads now carry text/verse/verseEnd; the tooltip only uses numbered per-verse rendering when a numeric starting verse exists — fixing NaN verse numbers on chapter-only tooltips.
  • External Services disclosure updated: verse fetches now happen server-side at render, with browser requests only as fallback.

Test plan

  • Live API contract verified with cache-bypass curls before implementation: 50-ref batches, chapter text/verse/verseEnd, ?preview= semantics, /openapi.json
  • End-to-end hydration test in WordPress Playground against the live API: 3 references linked → collected → hydrated inline (John 3:16 instant, Genesis 1:1-3 keeps 3-verse numbering, Psalms 119 truncated at 696 chars without verses[], total inline payload 2 093 bytes)
  • PHPCS (WordPress Coding Standards completo + PHPCompatibilityWP): 0 errors
  • PHPStan level 5 + WordPress extension: 0 errors
  • Official Plugin Check on bible-by-midvash-0.9.0-wporg.zip: "Success: Checks complete. No errors found."
  • i18n: no new translatable strings; versions matched in the three canonical places

🤖 Generated with Claude Code

…n chapter payloads

Puts the latest Midvash API capabilities to work:

- Server-side hydration: at wp_footer (priority 5, before footer scripts
  print), the references BBMV_Parser collected during the_content are
  resolved in one cache-aware /v1/passages call and inlined as
  window.bbm_prefetched — the tooltip JS seeds its in-memory cache from
  it, so the very first hover of the very first visitor opens with zero
  network round-trips. The 0.8.0 client-side batch prefetch remains as
  fallback for render-time upstream misses.
- Batch chunk raised 20 -> 50 to match the API's new limit.
- Lean inline payload: passages over 700 chars are trimmed at a
  verse-friendly cut with ellipsis + truncated flag, and verses[] arrays
  over 12 entries are dropped (tooltip renders text; Read more links to
  the full chapter). Full payloads stay cached server-side.
- Chapter shape fix: /v1 chapter payloads now carry text/verse/verseEnd,
  and the tooltip only uses numbered per-verse rendering when a numeric
  starting verse exists — fixes NaN verse numbers on chapter-only refs.

Verified in WordPress Playground against the live API: 3 refs hydrated
inline (2 KB total), Psalms 119 truncated without verses[], ranges keep
numbering. PHPCS, PHPStan and official Plugin Check all green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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