Skip to content

fix: lazy-load CodeMirror in sourcePeekEditor#437

Merged
claude[bot] merged 2 commits intomainfrom
fix/435-lazy-load-codemirror-source-peek
Mar 16, 2026
Merged

fix: lazy-load CodeMirror in sourcePeekEditor#437
claude[bot] merged 2 commits intomainfrom
fix/435-lazy-load-codemirror-source-peek

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Mar 16, 2026

Summary

  • Converts static import of 6 @codemirror/* modules in sourcePeekEditor.ts to dynamic import(), loaded once on first source-peek activation
  • Preserves the synchronous createCodeMirrorEditor API — returns container immediately, mounts CodeMirror asynchronously inside it
  • Updates tests to await the async initialization

Closes #435

Test plan

  • All 143 sourcePeekInline tests pass (18 editor + 25 tiptap + 38 actions + 36 header + 26 integration)
  • pnpm check:all passes (lint, tests, build)
  • Manual: open a document, use Source Peek on a block — verify CodeMirror editor appears and functions normally

🤖 Generated with Claude Code

@claude claude bot enabled auto-merge (squash) March 16, 2026 09:47
@xiaolai xiaolai force-pushed the fix/435-lazy-load-codemirror-source-peek branch 4 times, most recently from 50aab34 to fc83cd4 Compare March 16, 2026 11:39
github-actions bot and others added 2 commits March 16, 2026 19:43
…) code split

Static imports of @codemirror/* in sourcePeekEditor.ts pulled ~150-200KB
of CodeMirror modules into the main WYSIWYG bundle, defeating the
React.lazy() code split for SourceEditor. Switch to dynamic import()
so CodeMirror is only loaded when a user first activates source peek.

Closes #435

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@xiaolai xiaolai force-pushed the fix/435-lazy-load-codemirror-source-peek branch from fc83cd4 to f181142 Compare March 16, 2026 11:43
@claude claude bot merged commit 25083b1 into main Mar 16, 2026
3 checks passed
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.

[audit] performance: sourcePeekInline statically imports CodeMirror, defeating React.lazy() code split

1 participant