Skip to content

Floating margin comments dropped on long documents — only ~one page's worth renders (30/46 placeholders left empty) #3260

@hjalmarbouma

Description

@hjalmarbouma

Summary

On a multi-page .docx containing many Word comments, SuperDoc's floating-comment renderer drops most comment cards from the margin gutter. Inline highlights and gutter placeholders are created for every comment, but only the comments belonging roughly to the currently-active page are materialised as visible cards. Scrolling, resizing, dispatching an empty ProseMirror transaction, calling commentsStore.handleEditorLocationsUpdate, and even fully destroying + re-mounting the SuperDoc instance on the exported .docx do not cause the missing cards to appear.

The underlying data is intact — downloading the document and opening it in Microsoft Word shows every comment in the margin correctly.

Environment

  • @harbour-enterprises/superdoc 1.32.0 (latest on npm at time of report)
  • Loaded from CDN: https://unpkg.com/@harbour-enterprises/superdoc@1.32.0/dist/superdoc.min.js
  • Browser: latest Chrome on macOS (also reproduced in Safari)
  • Config:
    new SuperDoc({
      selector: '#superdoc',
      toolbar: '#superdoc-toolbar',
      document: <File: ~30 page .docx with 46 Word comments>,
      documentMode: 'suggesting',
      pagination: true,
      modules: {
        comments:    { readOnly: false, allowResolve: true },
        trackChanges:{ visible: true, mode: 'review', replacements: 'paired' },
      },
      user: { name: '...', email: '...' },
    });

Reproduction

  1. Open a multi-page .docx with ~40+ Word-authored comments.
  2. Observe: inline comment highlights appear correctly on every page. Margin gutter on the first/active page shows comment cards. Margin gutter on later pages is empty despite the same inline highlights being present.
  3. Scroll to a later page where inline highlights exist — gutter remains empty for those comments.

Diagnostic snapshot

Run in the browser console while the document is open:

Layer Count
Unique data-comment-id values in DOM 46
.comment-placeholder elements 46
.comments-dialog.floating-comment (rendered cards) 16
.superdoc-comment-highlight (inline marks, incl. track-change overlays) 53 + 30

SuperDoc loads all 46 comments from word/comments.xml (✓) and reserves a placeholder per comment (✓), but only 16 placeholders ever receive an actual floating-comment card. 30 placeholders remain empty. The 16 corresponds roughly to one page's worth of comments.

What I tried (all without effect)

  • editor.view.dispatch(editor.view.state.tr) — empty ProseMirror transaction, fires every state listener.
  • superdoc.commentsStore.handleEditorLocationsUpdate(parentEl, ids) — direct call to the internal refresh entry point.
  • Programmatic scroll-through to force-paginate every page.
  • window.dispatchEvent(new Event('resize')) after the scroll-through.
  • Full destroy + re-mount of the SuperDoc instance on the freshly-exported .docx. Same 46-load / 16-render pattern after re-mount.

Expected

Either: every comment placeholder receives its card (no virtualisation), or: virtualisation correctly re-materialises cards as additional pages enter the viewport. Current behaviour leaves the user unable to see most of their comments in the editor, even though the underlying data is intact.

Workaround

For now I am extracting the comments server-side by reading word/comments.xml directly from the exported blob and rendering them in a separate side-panel, bypassing the floating-comment renderer entirely.

Happy to share a minimal-reproducer .docx privately if useful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions