Repository navigation
feat(media): preview PDFs in the library grid and viewer - #19
Merged
Merged
Conversation
AI tools relayed through the open editor (MCP / instatic CLI and the in-editor agent) reported success for writes the editor had refused or the server never received. A refused write leaves the store unchanged, so site_write_code_asset answered "updated" with the previous file's hash and page replaces "succeeded" without sticking. - CollabProvider.flush(): a ping sent after the last edit is a delivery receipt, because the relay answers each connection's frames in order. - collabWriteWatch ledger: transport refusals and data-losing server resets during a tool call turn its result into an actionable error. - runDeliveredSiteWrite wraps every site mutation tool: wait for the gate, run, then require no incident and a confirmed receipt. - Heartbeat: a late ping tick (busy or throttled main thread) waits one second before ruling, so a big page render no longer flips a healthy editor to "Offline — reconnecting". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ublish Publish ran esbuild per page, and each run first wrote every site script (including large disabled ones reachable through dynamic imports) to a temp workspace. Pages that load the same scripts produce byte-identical bundles, since outputs import each other relatively, so the build is now shared via createSiteRuntimeBuildCache() and only re-addressed under each page's version path. Measured on the 22-page dev site carrying the live site's scripts: runtime builds 653 ms -> 27 ms, full publish ~2.0 s -> ~0.9 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PDFs showed a folder icon in the grid and only a Download card in the viewer. They stay served as downloads (inline: false), so the library now fetches the bytes and draws pages with pdf.js instead: a lazily painted, page-by-page viewer with page count and Download, and a first-page thumbnail on grid tiles (rendered near the viewport, two at a time, cached per content version so Replace refreshes it). pdf.js runs in a worker with no document scripting and XFA off, and loads only when a PDF is shown. Non-PDF documents now show a file icon instead of a folder icon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Co-Authored-By: Claude Opus 5.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
PDFs in the media library showed a folder icon in the grid and only a Download card in the viewer. This change previews them in both places. PDFs are still served as downloads (
inline: false), so they never render on the admin origin. The library fetches the bytes and draws pages with pdf.js, which parses in a Web Worker, runs no document JavaScript, and has XFA disabled.This branch also carries two earlier commits that are stacked under it: collab delivery receipts (AI tool writes now report what the server actually received) and a shared runtime build cache in the publisher (each distinct script set is bundled once per publish). Both are described in
docs/features/site-shell.mdanddocs/features/publisher.md.Verification
bun run buildbun test(7,702 tests, 0 failing)bun run lintManual check: opened a PDF in the grid and viewer in a browser against a local development database. The cover page showed as the thumbnail and all pages showed in the viewer. Download worked.
Checklist
docs/features/media.md,docs/features/publisher.md,docs/features/site-shell.md,docs/features/mcp-connectors.md).