fix(desktop): stop packaged editor crash - #466
Conversation
electron-vite never loaded electron-vite.config.ts (it looks for electron.vite.config.ts). Production also bundled two @lezer/common copies, so HighlightStyle.style saw undefined tags. Pin common@1.5.2, emit one CodeMirror chunk, and open a note in smoke so the lazy editor actually loads.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe desktop Electron Vite configuration now consolidates CodeMirror and Lezer modules and pins ChangesDesktop CodeMirror integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The packaged editor build and smoke coverage are updated to address the reported crash, and no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #314 ## Why `.cm-table-visual` / `.sortable-table` were `width: 100%` with no `max-width` and no wrapping on cells. `.cm-table-widget` set `overflow-x: auto` then overwrote it with `overflow: hidden`, so long cells painted past the pane. ## What - `max-width: 100%` on both table classes - `overflow-wrap` / `word-break` on `th`/`td` - Keep `overflow-x: auto` on the editor wrapper; add `.sortable-table-wrap` for preview - Line decoration `.cm-table-range` over every table (including the one under the cursor) - No hard pixel cell widths - Unit test for `findTableRanges`; e2e inserts a wide table and asserts the widget is not wider than `.cm-scroller` **Note:** real per-range no-wrap while editing is deferred to the plugin-tables extraction. Editor-global `lineWrapping` still wraps raw pipe rows. The e2e opens the packaged editor, so it depends on #466 landing (or a local Electron rebuild of `better-sqlite3`). ## Verify ``` pnpm --filter @dripnex/desktop exec vitest run src/renderer/plugins/__tests__/tables.test.ts pnpm --filter @dripnex/desktop typecheck:renderer ```
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Summary Playwright e2e now types into the CodeMirror 6 surface instead of treating `.cm-content` as out of scope. The e2e README matches CI: the job is required (no `continue-on-error`). ## Type of Change - [x] Bug fix (test coverage / docs accuracy) - [ ] New feature - [ ] Breaking change - [x] Documentation update ## Related Issues #311 (packaged `tags is not iterable` — already closed by #466; this PR does not re-open it) ## What - `editor.spec.ts`: create first note → type a unique marker into `.cm-content` → assert it appears. Second case: replace doc with `- first item`, press Enter, assert continue-markup adds a sibling `- `. - `openFirstNote()` helper shared with smoke / tables. - README: typing is in scope for those tests; CI e2e is required; `tables.spec.ts` still skipped on CI; `pnpm e2e` still runs `out/`, not a packaged asar. ## Packaged crash (#311) Not reproduced in this Linux VM (no macOS `.app`). Current tree already has the #466 work: `manualChunks` for `@codemirror/*` + `@lezer/*`, `resolve.dedupe`, `@lezer/common` pin/alias, smoke that loads the lazy editor. Vite 8 deprecates function-form `manualChunks` in favor of Rolldown `codeSplitting.groups` — I will inspect the built `out/renderer` chunks in this PR and only change bundling if the split is still wrong. I will not guess an asar rewrite without a repro. ## Checklist - [ ] Tests pass locally (`pnpm test` / desktop e2e) - [ ] Build succeeds (`pnpm --filter @dripnex/desktop build`) - [x] PR targets `develop` branch (not `main`) <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-a4c7c79b-af1e-4afa-930f-7dd0ed529d6f?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-a4c7c79b-af1e-4afa-930f-7dd0ed529d6f&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Closes #311
Why
The packaged editor crashed on first note with
[CodeMirror] plugin error: TypeError: tags is not iterable. Two things had to be true at once:electron-vite.config.ts; electron-vite only readselectron.vite.config.ts.optimizeDeps.includeand every other renderer option were no-ops.@lezer/commoncopies (1.5.0 nested under@lezer/highlight, 1.5.2 under language/markdown). Each has its ownNodeProp, soHighlightStyle.stylereceivedundefined.Chunk splitting alone did not fix it — the smoke test still went red until common was pinned.
What
manualChunks:@codemirror/*+@lezer/*→codemirrorresolve.dedupe+ alias@lezer/commonto the desktop copy@lezer/common@1.5.2and add it as a desktop dependency.cm-content, fail if[CodeMirror]appears in the consoleexternalizeDeps: true) sobetter-sqlite3is not inlinedVerify
Local e2e needs
better-sqlite3rebuilt for Electron 41 (electron-rebuild --force --only better-sqlite3).Deploy order
Desktop only. No contract change for other repos.
Summary by CodeRabbit
Bug Fixes
Tests