You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shared markdown parse/serialize editor in markdown-parse.ts was mounted, so every serialize rendered the doc into a hidden DOM view. ProseMirror's DOMObserver schedules a 20ms flush timer it never tracks, so nothing can cancel it; in jsdom suites it fired after teardown and failed CI with ReferenceError: document is not defined in whichever test file happened to finish first
Build that editor unmounted (element: null), with no view, observer, or timers. TipTap only installs extension plugins on mount, so they're installed via state.reconfigure the same way, keeping normalization (e.g. the trailing paragraph) identical to the live editor
serializeDocToMarkdown sets content with emitUpdate: false: nothing listens to the scratchpad, and the update made TipTap's core Delete extension defer a timer on every serialize
markdown-paste.test.ts leaked a mounted editor: its single editor slot was overwritten when one test mounted twice, so the first was never destroyed and its observer timer could fire after teardown. mount() now registers every editor and afterEach destroys them all (an audit of every file-viewer test found no other leak)
Drop a dead cleanups hook from block-image-paragraph.test.ts that nothing pushes into
Type of Change
Bug fix
Testing
Reproduced deterministically in a scratch jsdom test (serialize, drop document, wait): old code throws the exact CI error, new code throws nothing
Serialization parity: all 705 .md/.mdx files in the repo serialize byte-identically through a mounted editor vs the new unmounted one
Regression test in markdown-parse.test.ts: fresh module under fake timers, serialize, assert no pending timers. Red in whole-file runs with the editor mounted again, with the update emitted, and on the pre-PR file; green with the fix
[Medium risk] Fixes timer leaks in the shared markdown parser.
The PR appears safe to merge; no outstanding finding or new actionable issue was identified.
Summary
The PR keeps the shared Markdown parser editor unmounted to avoid deferred DOM-observer work, suppresses unnecessary scratchpad updates, and tightens test cleanup and timer coverage.
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
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
markdown-parse.tswas mounted, so every serialize rendered the doc into a hidden DOM view. ProseMirror'sDOMObserverschedules a 20ms flush timer it never tracks, so nothing can cancel it; in jsdom suites it fired after teardown and failed CI withReferenceError: document is not definedin whichever test file happened to finish firstelement: null), with no view, observer, or timers. TipTap only installs extension plugins on mount, so they're installed viastate.reconfigurethe same way, keeping normalization (e.g. the trailing paragraph) identical to the live editorserializeDocToMarkdownsets content withemitUpdate: false: nothing listens to the scratchpad, and the update made TipTap's core Delete extension defer a timer on every serializemarkdown-paste.test.tsleaked a mounted editor: its singleeditorslot was overwritten when one test mounted twice, so the first was never destroyed and its observer timer could fire after teardown.mount()now registers every editor andafterEachdestroys them all (an audit of every file-viewer test found no other leak)cleanupshook fromblock-image-paragraph.test.tsthat nothing pushes intoType of Change
Testing
document, wait): old code throws the exact CI error, new code throws nothing.md/.mdxfiles in the repo serialize byte-identically through a mounted editor vs the new unmounted onemarkdown-parse.test.ts: fresh module under fake timers, serialize, assert no pending timers. Red in whole-file runs with the editor mounted again, with the update emitted, and on the pre-PR file; green with the fixcheck:audits(49 audits),docs-manifest:checkpassChecklist
test-auditauthoring gate)