Skip to content

perf: lazy-load document pdf viewer#831

Merged
BigSimmo merged 5 commits into
mainfrom
codex/frontend-document-viewer-lazy-20260718-clean
Jul 18, 2026
Merged

perf: lazy-load document pdf viewer#831
BigSimmo merged 5 commits into
mainfrom
codex/frontend-document-viewer-lazy-20260718-clean

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Deferred pdf-canvas-viewer loading in src/components/DocumentViewer.tsx behind next/dynamic() so PDF-specific code is fetched only when a PDF is rendered.
  • Added an accessible PDF loading fallback during the dynamic chunk load.
  • Added/kept a regression test in tests/document-viewer-pdf-reader-lazy.test.ts to ensure the PDF viewer imports remain outside the initial document client chunk.

Verification

  • ./node_modules/.bin/vitest run tests/document-viewer-pdf-reader-lazy.test.ts --reporter=dot (pass)
  • npm run verify:cheap (blocked: docs/site-map.md is stale; no sitemap update included in this PR)
  • npm run verify:ui not run: environment-level font/network constraint prevents stable local UI run in this task context.
  • UI verification not run: local browser + ensure path could not complete due external resource fetch issues in this environment.

Clinical Governance Preflight

Not required. This change is limited to frontend bundle loading behavior in the document viewer and does not affect ingestion, answer generation, source rendering, clinical logic, or privacy-sensitive pathways.

Risk and rollout

Low-risk UI performance optimization. Behavior remains the same for PDF rendering, with a loading placeholder added for the lazy-loaded chunk; no new clinical logic or data-flow changes.

@supabase

supabase Bot commented Jul 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

PDF preview components now load through client-only dynamic imports, using a shared accessible loading indicator while the PDF reader becomes available.

Changes

PDF viewer loading

Layer / File(s) Summary
Dynamic PDF viewer integration
src/components/DocumentViewer.tsx
PdfCanvasViewer and NativePdfEmbed are dynamically imported with server-side rendering disabled and share an accessible “Loading PDF reader…” fallback.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: codex

Suggested reviewers: claude, copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title concisely reflects the main change: lazily loading the document PDF viewer for performance.
Description check ✅ Passed The description covers Summary, Verification, Clinical Governance Preflight, and Risk/Rollout, with only the Notes section left blank.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/frontend-document-viewer-lazy-20260718-clean

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

CI triage

CI failed on this PR. Automated classification of the 6 failed job(s):

  • Unit coverageneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Production UIneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Buildneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Advisory UIneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #3205 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

@BigSimmo
BigSimmo enabled auto-merge July 18, 2026 07:38
@BigSimmo
BigSimmo merged commit e9ce2d4 into main Jul 18, 2026
15 checks passed
@BigSimmo
BigSimmo deleted the codex/frontend-document-viewer-lazy-20260718-clean branch July 18, 2026 08:15
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