perf: lazy-load file content + fix oversized tile labels #5
Reference in New Issue
Block a user
Delete Branch "perf/lazy-load-and-font-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #2
问题
computeColorRanges对每个文件同步跑 highlight.js,直接卡住min(w,h) * 0.15无上限,容易算出 20–30 world units)改动
服务端 (
server/src/main.rs)content),新增strip_content()在发送前递归清空FileNode改为TreeResponse { cache_key, tree },前端拿到 key 后可按需拉内容GET /api/repos/{key}/file?path=...按单文件返回内容(从 SQLite cache 中读全树再定位)前端 (
web/src/renderer.js,web/src/app.js)load()不再调用computeColorRanges,彻底去掉加载时的同步 CPU 突刺_showCode()发现tile.data.content为空时,调用_fetchContent()异步拉取,拿到内容后再计算 colorRangesloading标志防止重复 fetchMath.min(Math.min(w, h) * 0.15, 5)- Server now returns metadata-only tree on initial load (no file content in the JSON payload); content is served on-demand via the new GET /api/repos/{key}/file?path=... endpoint - Cache still stores full content; strip_content() runs in-memory before the response is sent - Frontend fetches file content lazily in _fetchContent() when a tile enters the LOD view, preventing a massive upfront JSON download for large repos (e.g. claude code) - computeColorRanges() is now deferred to first _showCode() call instead of running synchronously for every file during load() - Cap label fontSize at 5 world units to prevent giant text on large tiles