mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
11db8e89bf
Findings from a self-review pass on this PR:
- code-block.tsx: hoist the seven per-row inline-style objects to module
scope so the file-render hot path stops re-allocating ~3 fresh objects
per line per render. ~500-line demos previously allocated ~1.5k style
objects on every parent re-render.
- page.tsx URL-sync effect: add a same-value guard before
history.replaceState so unrelated re-renders don't write the same
query string back to the address bar.
- page.tsx FileTreeRow: collapse the color ternary chain — both selected
and highlighted leaves resolve to the same primary color, so
`isSelected || isHighlighted ? primary : disabled` reads cleaner than
the nested `?:?:`.
- page.tsx: trim the restated WHAT-comment above the reset-on-demo
effect (the function body already says what the comment said).
- vitest.setup.ts MemoryStorage: coerce keys in getItem/removeItem to
match setItem and the real Storage spec (all key args coerce to string).
Deferred to a follow-up PR (would also touch showcase/shell/* and
showcase/shell-docs/*): hoisting `escapeHtml` (5 copies in the repo
today), the hljs `try { highlight } catch { escapeHtml }` pattern (also
copied), and the file-tree build/sort utilities the dojo duplicates from
showcase/shell/.../code/page.tsx.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>