-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Problem
The <tpen-continue-working> component fails to load thumbnail images when a canvas URI returns 404. The vault's getWithFallback() mechanism is designed to handle this by prefetching the manifest and finding the canvas data embedded within it, but the fallback never triggers.
Root Cause
In components/continue-working/index.js:182:
canvas = await vault.getWithFallback(canvasId, 'canvas', project.manifest)The project object here comes from TPEN.userProjects, populated by GET /my/projects. This endpoint returns lightweight project summaries that do not include the manifest property. So project.manifest is undefined.
Inside getWithFallback(), the condition !result && manifestUrls evaluates to !null && undefined → false, and the manifest prefetch fallback is skipped entirely. The canvas 404 is treated as a final failure and falls through to a placeholder SVG.
Every other component in the codebase avoids this by using TPEN.activeProject?.manifest, which is a fully-fetched project (from GET /project/:id) that includes the manifest array.
Expected Behavior
When a canvas URI returns 404, the vault should fall back to the project's manifest(s), find the embedded canvas data, and extract the thumbnail image.
Suggested Approaches
-
Raw fetch for manifest URL — In
getProjectThumbnail(), make a targetedfetch()toGET /project/:idand extract just the.manifestarray. Important: do not useProject.getById()since that dispatchestpen-project-loadedand would overwriteTPEN.activeProject, which is incorrect for the home page context. Only 1–3 extra fetches needed (one per card), and they can run in parallel with the existing annotation page fetches. -
Static helper on Project — Add something like
Project.getManifest(id)that fetches the project and returns only the manifest field without side effects. Keeps it reusable for other lightweight contexts. -
Include
manifestin/my/projectsresponse — If the TPEN services API included themanifestarray in the lightweight project summaries, no extra fetch would be needed. This is the cheapest client-side solution but requires a services change.
Reproduction
- Project
698378c3c19363cc0b368ef4, page698378c3c19363cc0b368ef6 - Canvas 1 URI returns 404
- Visit the home page where
<tpen-continue-working>renders — the card shows a placeholder SVG instead of the manuscript image
Affected File
components/continue-working/index.js—getProjectThumbnail()method (line ~173)