fix(ui): dedupe @codemirror/state to fix Environment tab crash (#1780)#1781
Conversation
pnpm-lock.yaml resolved two @codemirror/state versions (6.6.0 pulled by @codemirror/lang-*/language/commands/autocomplete, 6.7.0 pulled by @uiw/react-codemirror + the codemirror meta-package). CM6 validates extensions with instanceof against @codemirror/state, so loading two copies breaks the check and throws "Unrecognized extension value in extension set" when the Environment tab mounts its CodeMirror editor. Pin @codemirror/state to 6.7.0 in pnpm.overrides, mirroring the existing @codemirror/view override, so pnpm collapses both to a single version. Fixes #1780 Co-Authored-By: Claude <noreply@anthropic.com>
|
Richard's agent here: I reviewed this and the fix direction makes sense to me. No blocking code findings. The PR addresses the reported CodeMirror crash at the right layer: the lockfile had two physical Small cleanup before merge, if easy: could we keep the lockfile diff limited to the CodeMirror collapse by restoring the unrelated Validation looks reasonable: CI is green and the PR includes build + bundle-level verification. The only remaining gap is a live Environment tab smoke-test, so I’d be comfortable merging after either a quick preview click-through or accepting that as the post-merge/manual verification step. |
richardfogaca
left a comment
There was a problem hiding this comment.
Approving — no blocking code findings from my review. The cleanup notes I left are non-blocking.
…rror-only Addresses review feedback on #1781 — the pnpm install regenerated an unrelated libsql@0.5.29 `cpu` field drop; restore it so the diff is limited to the @codemirror/state collapse. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Opening the Environment tab in a branch's config modal crashed with:
Root cause:
pnpm-lock.yamlresolved two@codemirror/stateversions —6.6.0(pulled in by@codemirror/lang-*,language,commands,autocomplete) and6.7.0(pulled in by@uiw/react-codemirror@4.25.10+ thecodemirrormeta-package). CM6 validates extensions viainstanceofchecks against@codemirror/stateclasses, so having two physically-installed copies breaks those checks and throws when theCodeEditorcomponent (apps/agor-ui/src/components/CodeEditor/) mounts inside the Environment tab. Rootpackage.json'spnpm.overridesalready pinned@codemirror/view: 6.43.0but had no equivalent pin for@codemirror/state, andvite.config.ts'sresolve.dedupealone can't collapse two physically-installed versions.Fix: Added
"@codemirror/state": "6.7.0"topnpm.overridesin rootpackage.json, mirroring the existing@codemirror/viewpin, then regenerated the lockfile.grep -c "'@codemirror/state@6" pnpm-lock.yaml→ 8 occurrences (4×6.6.0, 4×6.7.0acrossoverrides/packages/snapshotssections)grep "'@codemirror/state@" pnpm-lock.yaml→ only6.7.0, single versionTest plan
pnpm-lock.yamlhad both@codemirror/state@6.6.0and@codemirror/state@6.7.0before the fixpnpm install, confirmed lockfile now resolves a single@codemirror/state@6.7.0@agor/git,@agor/core,@agor-live/client) needed for a full typecheck in this fresh worktreepnpm --filter agor-ui buildsucceeds (tsc -b && vite build), exit code 0, no errors@codemirror/state's internals (one chunk,editor-*.js, carries the "Unrecognized extension value" string andEditorStateclass — no duplicate definitions in other chunks)Fixes #1780