Skip to content

Tracked changes rails sync with new virtualization#2

Open
aaron-hirundo wants to merge 10 commits into
mainfrom
codex/perf-57-eval
Open

Tracked changes rails sync with new virtualization#2
aaron-hirundo wants to merge 10 commits into
mainfrom
codex/perf-57-eval

Conversation

@aaron-hirundo
Copy link
Copy Markdown

@aaron-hirundo aaron-hirundo commented Feb 23, 2026

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Implements page virtualization and layout throttling to optimize the rendering of large documents. Enhances the DOCX synchronization logic to handle footnotes and endnotes while ensuring the review rail overlay remains aligned with virtualized content.

TopicDetails
Page Virtualization Introduces IntersectionObserver to lazily render pages and implements layout coalescing via requestAnimationFrame to improve performance.
Modified files (7)
  • e2e/fixtures/large-36-page.docx
  • e2e/fixtures/very-large-50-page.docx
  • scripts/generate-large-doc.ts
  • src/layout-bridge/measuring/cache.ts
  • src/layout-painter/renderPage.ts
  • src/paged-editor/PagedEditor.tsx
  • src/plugins/review/components/ReviewPageRailOverlay.tsx
Latest Contributors(0)
UserCommitDate
DOCX Note Sync Adds serialization and removal logic for footnotes and endnotes within the buildDirectXmlOperationPlan to support accurate document synchronization.
Modified files (3)
  • src/docx/buildDirectXmlOperationPlan.test.ts
  • src/docx/buildDirectXmlOperationPlan.ts
  • src/docx/serializer/notesSerializer.ts
Latest Contributors(1)
UserCommitDate
aaron@hirundo.ioCodex-review-mode-v1-p...February 24, 2026
This pull request is reviewed by Baz. Review like a pro on (Baz).

@baz-reviewer
Copy link
Copy Markdown

baz-reviewer Bot commented Feb 23, 2026

This change request has over 100 files and exceeds the review limit. Consider splitting it into smaller CRs for faster and more effective reviews

You can still request a review by commenting baz review.

jedrazb and others added 6 commits February 23, 2026 16:31
…genpal#57)

Three changes to handle 30+ page documents without crashing:

1. Page virtualization: Documents with 8+ pages only render visible pages
   plus a small buffer. Off-screen pages are lightweight shells with correct
   dimensions for scrolling. IntersectionObserver lazy-loads content as
   pages scroll into view and depopulates distant pages.

2. Increased measurement cache sizes: Text width cache 5K→20K, paragraph
   cache 1K→5K. Prevents cache thrashing on large documents that generate
   tens of thousands of unique measurements.

3. rAF-coalesced layout: Rapid keystrokes within the same animation frame
   are coalesced so only the final document state triggers a full layout
   pass, reducing redundant work during fast typing.

Tested with an 81-page generated document: DOM elements reduced from
22,738 to ~8,800 (93% page virtualization), no console errors, editing
works correctly mid-document.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The paragraph measurement cache existed but was never called. Now
measureBlock() checks the cache before measuring paragraphs (for blocks
without floating image zones). On a 36+ page document, subsequent edits
skip measurement for all unchanged paragraphs — only the edited
paragraph gets re-measured.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread src/main.tsx Outdated
Comment thread src/docx/buildDirectXmlOperationPlan.ts
Comment thread src/docx/buildDirectXmlOperationPlan.ts
Comment thread src/plugins/review/components/ReviewPageRailOverlay.tsx Outdated
aaron-hirundo and others added 3 commits February 24, 2026 16:17
* fix: preserve tracked changes round-trip

* feat: isolate direct xml save workflow and diagnostics

* feat: review plugin v1 with tracked changes panel and actions

* refactor: share direct-xml planner and review presentation helpers

* fix(review): unify revision decision path and enable header/footer selection

---------

Co-authored-by: Jedr Blaszyk <jedrazb@gmail.com>
Co-authored-by: Aaron Dov Malkin <adov@Aarons-MacBook-Pro.local>
@aaron-hirundo
Copy link
Copy Markdown
Author

baz review

Comment on lines +11 to +35
const NAMESPACES: Record<string, string> = {
wpc: 'http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas',
mc: 'http://schemas.openxmlformats.org/markup-compatibility/2006',
o: 'urn:schemas-microsoft-com:office:office',
r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
m: 'http://schemas.openxmlformats.org/officeDocument/2006/math',
v: 'urn:schemas-microsoft-com:vml',
wp14: 'http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing',
wp: 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing',
w10: 'urn:schemas-microsoft-com:office:word',
w: 'http://schemas.openxmlformats.org/wordprocessingml/2006/main',
w14: 'http://schemas.microsoft.com/office/word/2010/wordml',
w15: 'http://schemas.microsoft.com/office/word/2012/wordml',
wpg: 'http://schemas.microsoft.com/office/word/2010/wordprocessingGroup',
wps: 'http://schemas.microsoft.com/office/word/2010/wordprocessingShape',
};

function buildNamespaceDeclarations(): string {
return Object.entries(NAMESPACES)
.map(([prefix, uri]) => `xmlns:${prefix}="${uri}"`)
.join(' ');
}

function serializeNoteParagraphs(paragraphs: Paragraph[]): string {
const serialized = paragraphs.map((paragraph) => serializeParagraph(paragraph)).join('');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicates the exact NAMESPACES + buildNamespaceDeclarations logic from serializer/headerFooterSerializer.ts; every addition/removal will need to be updated in two places and increases maintenance. Can we import and reuse the shared namespace helper (or move the constant into a utility) instead of copying it here?

Finding type: Code Dedup and Conventions

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.

2 participants