Skip to content

[codex] Fix large document preview rendering#157

Merged
ThisIs-Developer merged 3 commits into
mainfrom
codex/fix-large-preview-engine
Jun 4, 2026
Merged

[codex] Fix large document preview rendering#157
ThisIs-Developer merged 3 commits into
mainfrom
codex/fix-large-preview-engine

Conversation

@ThisIs-Developer
Copy link
Copy Markdown
Owner

Summary

Reworks the shared Markdown preview render path so large-document updates stay atomic and do not replace the existing preview with a skeleton during normal edits.

Root Cause

Issue #143 came from treating every large-document render as a loading cycle. For documents over 15K characters, editor input could immediately replace the last good preview with the skeleton before the new render committed. If the render was skipped or superseded, the skeleton could remain visible indefinitely.

Changes

  • Adds preview render generations and pending-work cancellation so stale async work cannot commit over newer content.
  • Keeps the last committed preview visible during same-document edits.
  • Gates the article skeleton to initial large renders and document swaps instead of every edit.
  • Adds adaptive large-document render delays and idle/frame scheduling.
  • Patches top-level preview DOM nodes where possible to reduce churn and preserve scroll stability.
  • Mirrors the shared web fix into the packaged desktop runtime.
  • Bumps the service-worker cache key so PWA users receive the updated engine.

Validation

  • node --check script.js
  • node --check desktop-app/resources/js/script.js
  • node --check sw.js
  • Manual/browser validation previously run with generated 15K, 50K, 100K, and 250K character documents in Edge/Chromium.

Note: the local large-document test harness was intentionally not included in this PR, per request.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview, Comment Jun 4, 2026 4:40pm

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 4, 2026

Deploying markdown-viewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: cb0c752
Status: ✅  Deploy successful!
Preview URL: https://678b12df.markdown-viewer.pages.dev
Branch Preview URL: https://codex-fix-large-preview-engi.markdown-viewer.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 4, 2026

Deploying markdownviewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: cb0c752
Status: ✅  Deploy successful!
Preview URL: https://5c155338.markdownviewer.pages.dev
Branch Preview URL: https://codex-fix-large-preview-engi.markdownviewer.pages.dev

View logs

@ThisIs-Developer ThisIs-Developer marked this pull request as ready for review June 4, 2026 16:43
@ThisIs-Developer ThisIs-Developer merged commit 9bc8675 into main Jun 4, 2026
6 checks passed
@ThisIs-Developer ThisIs-Developer deleted the codex/fix-large-preview-engine branch June 4, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant