Delegate DEER expand() to RERUM /gog/id/:_id#319
Open
thehabes wants to merge 5 commits into
Open
Conversation
This was referenced Jul 15, 2026
thehabes
marked this pull request as ready for review
July 17, 2026 16:51
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
Delegates DEER's client-side
expand()to the new server-side/gog/id/:_idendpoint, so the Gallery of Glosses list no longer expands hundreds of Glosses in the browser or caches them inlocalStorage. This is the front-end half of the coordinated fix for #310 ("Too Many Glosses forlocalStorage").Paired back-end PR: CenterForDigitalHumanities/rerum_server_nodejs#280.
Problem
glosses.htmlexpands every Gloss on the client — fetch the object,POST /queryfor its targeting Annotations, then merge. That took 6–10 minutes, so results were cached inlocalStorage(expandedEntities), which overflowed the quota (QuotaExceededError) and stopped the list mid-load. #310 chooses to expand on the server behind a stable, browser-cacheable URL and have the client accept the finished object without re-expanding.Changes
UTILS.getExpandedURL(uri)(js/deer-utils.js): builds<host>/gog/id/<id>— rebuilding the id against the configured store (DEER.URLS.BASE_ID) and stripping the/v1API prefix, since/goglives at the server root — so it resolves in every environment (local and production) and works whether the object is keyed by@idorid. Returnsnullfor non-RERUM URIs.UTILS.expand()(js/deer-utils.js) now fetches that URL and returns the finished object as-is — nofindByTargetId, no client-side merge. It falls back to the legacy client-side expand for non-RERUM URIs, or if the endpoint is unavailable (e.g. not yet deployed) or returns a non-OK response.js/deer-config.js×3,js/deer-render.js): the.cachedNotice(which holds the.newcacherefresh link) is set todisplay: nonein the managed-list templates. With expansion now served behind a 24h HTTP cache, the old localStorage-based refresh affordance no longer does what it implies, so it is hidden until the refresh UX is reworked.Because the change lives in the shared
expand(), the whole app benefits (gloss list, gloss-metadata, manuscripts, witnesses). The stable per-object URL is browser-cached for 24h, so first load is N cacheable GETs with no per-GlossPOST /query, and subsequent visits are served from cache.Notes and follow-ups
.cachedNotice/.newcache"reload the data" affordance is hidden (not removed). When it comes back it should bust the browser HTTP cache for the per-object/gog/id/:_idURLs so a refresh actually pulls fresh data.expandedEntitiescache plumbing.