mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Opening a workspace with a large diff blocked the JS thread because the full structured diff (hunks, lines, syntax tokens) was sent over the wire and parsed via JSON.parse + Zod safeParse on the main thread. Add namespaced checkout RPCs that split diff delivery into two phases: 1. **Metadata-only snapshots** (`checkout/subscribe_diff` → `checkout/diff_snapshot`) — lightweight file list with status, path, insertions/deletions, and a fingerprint. Sent on every file-system change. No hunks, no tokens. 2. **On-demand hunk fetching** (`checkout/get_file_hunks` → `checkout/file_hunks_response`) — full structured diff for a single file, fetched when the user expands it. Served from an in-memory cache with a single-file git fallback. Feature detection via `server_info.features.lazyDiffRpcs`. New clients fall back to the V1 full-diff path when talking to older daemons. Old clients are completely unaffected — all new schema fields are optional and new message types are additive. Per-file fingerprints (hash of hunks excluding tokens) drive React Query cache invalidation so expanded files auto-refresh only when their actual content changes.