summarum/.jules/bolt.md
google-labs-jules[bot] 4fb4e3db04 perf: optimize CodeMirror decoration fields to avoid unnecessary rebuilds
Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
2026-07-08 08:34:51 +00:00

3 lines
No EOL
518 B
Markdown

## 2024-11-20 - [Avoid unnecessary CodeMirror rebuilds]
**Learning:** Highlight and Sparkline decorators in CodeMirror trigger `buildDecorations` on every transaction by default, which gets slow as document size increases (e.g. 50+ lines). It re-runs the lexer across the whole document on every keystroke if we do not check `tr.docChanged`/etc.
**Action:** Use `tr.docChanged` to selectively run `buildDecorations` or just use `value.map(tr.changes)` when only the text changed and results haven't been processed yet.