Repository navigation
Fix: handle CodeMirror race condition error gracefully - #67
Merged
Tkaixiang merged 1 commit intoJan 14, 2026
Merged
Conversation
Add defensive handling for a known CodeMirror 5 race condition that causes "Cannot read properties of undefined (reading 'map')" errors when clicking in the source code editor during rapid state changes. Changes: - Add null check in adjustCursor() for when cm.getLine() returns null - Add isCodeMirrorRaceCondition() to detect and suppress non-fatal CodeMirror errors instead of showing an error dialog This is a known Vue/CodeMirror 5 compatibility issue where Vue's reactive proxy system can interfere with CodeMirror's internal line measurement data structures. See: codemirror/codemirror5#6886
mdsakalu
force-pushed
the
fix/codemirror-race-condition
branch
from
January 13, 2026 22:39
b6a1233 to
73fbc9e
Compare
Tkaixiang
approved these changes
Jan 14, 2026
Tkaixiang
left a comment
Owner
There was a problem hiding this comment.
LGTM, I can't personally re-produce such errors reliably but I have definitely encountered them before. These changes are logically sound defensive checks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
TypeError: Cannot read properties of undefined (reading 'map')errors when clicking in the source code editor during rapid state changesadjustCursor()for whencm.getLine()returns null (cursor beyond document bounds)Root Cause
This is a known Vue/CodeMirror 5 compatibility issue where Vue's reactive proxy system can interfere with CodeMirror's internal line measurement data structures during mouse click handling.
See: codemirror/codemirror5#6886
Error Stack Trace (before fix)
Test Plan