Closed
Conversation
Introduce a seed-based hydration path and helper (hydrateFromObject) so an already-provided item object can be used if the network fetch fails. Reorder logic to define hydration first, use the seed fallback on non-OK responses and exceptions, and return the hydrated object. Also adjust calls to this.get and this.set to pass the embedded object and the correct type. Local caching to localStorage is preserved.
Add Vault.prefetchDocuments to eagerly cache manifest documents and use it when a canvas or annotation page cannot be resolved from the vault. Components updated (continue-working, transcription-block, transcription interface) now attempt to hydrate all project manifests and retry vault lookups before falling back to placeholders. getImage was converted to async and now uses vault.get (with prefetch) instead of direct fetch, with explicit fallbacks to 404/no-image assets. These changes reduce failed network fetches and improve resolution of IIIF v2/v3 canvases and pages.
Replace ad-hoc fetches with the centralized vault API across multiple components and add a manifest prefetch fallback when an item is not immediately resolvable. Components updated: annotorious-annotator/line-parser, column-selector, continue-working, default-transcribe, legacy-annotator/plain, line-image, simple-transcription — they now import and use the shared vault, attempt vault.prefetchDocuments(TPEN.activeProject.manifest) when a resource is missing, and retry resolving. Default-transcribe and others now use vault.get for annotation/page/contentresource resolution and show clearer failure messages. Major Vault improvements (js/vault.js): - Normalizes IDs (removes fragment, expands 24-char Mongo hex IDs to TPEN.RERUMURL/id/...). - Deduplicates concurrent fetches with inFlightPromises to avoid duplicate network requests. - Improved hydration: walks embedded objects, queues and caches known IIIF resource types, skips common non-resource properties, normalizes and caches discovered URLs/IDs, and stores data keyed by detected resource type when available. - More resilient fetch handling (returns null on failure if a seed exists) and safer localStorage writes keyed to resource type. - PrefetchDocuments now calls vault.get with a best-effort type and collects errors. - Removed the debug runVaultTest export. These changes make resource resolution more consistent and robust, reduce duplicate network loads, and allow components to recover by hydrating manifests when resources are initially missing.
Treat canvas/manifest/collection IDs as external/embedded (return empty URL) and simplify _normalizeId to only strip fragment identifiers. Add a _processIIIFResource helper to detect IIIF resources, call get() for them, and return a minimal {id,type,label} representation while avoiding duplicate fetches via the visited set. Update _fetchAndHydrate to invoke this helper for array items and non-array object values. Remove previous behavior that auto-prefixed Mongo hex IDs with TPEN.RERUMURL and the older string-URL detection/fetch logic to better handle embedded IIIF manifests and avoid incorrect fetching.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
#437) * Initial plan * Add guard to prevent fetch with empty URI Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
…ype parameters (#438) * Initial plan * Add prefetchManifests and prefetchCollections aliases and update all usages Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> * Refactor prefetch methods to use docType parameter instead of duplicating code Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
* Initial plan * Fix N+1 fetch issue by caching embedded IIIF resources directly Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> * Improve comments explaining embedded object detection logic Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> * Improve embedded object detection with specific content properties Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> * Allow annotations with body OR target to be cached as embedded Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
* Initial plan * Fix IIIF v2 prefix handling in type normalization Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> * Move prefix pattern to class constant and document resource types Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> * Revert prefix stripping; explicitly add IIIF v2 prefixed types Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> * Clarify documentation for agent and annotationlist types Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
This component should not include these dependencies.
Add an import for the vault module (../../js/vault.js) in components/read-only-transcribe/index.js so the component can access vault-related functionality.
… handling, and performance issues (#442) * Initial plan * Address Issues 13-17: Fix vault consistency, error handling, and performance issues Co-authored-by: cubap <1119165+cubap@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
…dd getWithFallback helper (#445) Issues Fixed: - Issue 8: Move SKIP_PROPERTIES and IIIF_RESOURCE_TYPES to module scope to prevent recreation on every fetch (28 + 13 = 41 object allocations eliminated per fetch) - Issue 9: Extract vault.getWithFallback() helper method to consolidate repeated 5-line fallback pattern used in 10+ locations - Issue 10: Fix noCache parameter to bypass in-memory store, not just localStorage. When noCache=true, caller gets fresh fetch, not stale cached copy - Issue 11: Clone data with structuredClone() before BFS mutation to prevent corrupting caller's original object via shared reference Performance Impact: - Eliminates unnecessary Set allocations (Issue 8) - Reduces code duplication and maintenance burden (Issue 9) - Fixes cache bypass behavior (Issue 10) - Prevents data corruption bugs (Issue 11)
* update conditions to fix pre existing errors * update conditions to fix pre existing errors
Replace repeated vault.get + prefetchManifests patterns with a single vault.getWithFallback utility to simplify resource resolution and avoid duplicated manifest-hydration logic. Affected components: annotorious-annotator/line-parser.js, column-selector/index.js, continue-working/index.js, default-transcribe/index.js, legacy-annotator/plain.js, simple-transcription/index.js, transcription-block/index.js, interfaces/transcription/index.js. Preserves existing behavior (including the optional strict flag) while centralizing the fallback to project manifests.
Contributor
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.
No description provided.