Release v0.9.0 — zero-latency verse tooltips via server-side hydration - #22
Open
onetogregorio wants to merge 1 commit into
Open
Release v0.9.0 — zero-latency verse tooltips via server-side hydration#22onetogregorio wants to merge 1 commit into
onetogregorio wants to merge 1 commit into
Conversation
…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>
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
Builds on the newest Midvash Bible API capabilities (verified live against production before coding):
the_contentare now resolved server-side at render time in a single cache-aware/v1/passagescall (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.truncatedflag, bulkyverses[]arrays are dropped from the inline map, and "Read more" links to the full chapter. Full payloads remain in the server-side transient cache.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.Test plan
text/verse/verseEnd,?preview=semantics,/openapi.jsonJohn 3:16instant,Genesis 1:1-3keeps 3-verse numbering,Psalms 119truncated at 696 chars withoutverses[], total inline payload 2 093 bytes)bible-by-midvash-0.9.0-wporg.zip: "Success: Checks complete. No errors found."🤖 Generated with Claude Code