perf(web): memo FlowNode + GPU-layer sprites#117
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR optimizes React Flow node rendering by memoizing the ChangesWeb Component Rendering Optimization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/init.ts`:
- Around line 341-346: The fallback hint is shown even when Tier‑1 clients exist
but are already installed; update the conditional that writes the message
(currently checking opts.json, installed, and wouldInstall) to also require that
no Tier‑1 targets were detected — e.g., add a check against the detection
collection used elsewhere in this module (look for the variable that holds
detected Tier‑1 targets, such as detectedTier1Targets / detectedTier1Clients /
similar) so the if becomes: if (!opts.json && installed.length === 0 &&
wouldInstall.length === 0 && detectedTier1Targets.length === 0) { ... } ensuring
the hint only appears when there are truly no detected Tier‑1 targets.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 182992e6-e4bc-49fb-9a50-4208113d2ec3
📒 Files selected for processing (3)
packages/cli/src/init.tspackages/web/src/components/nodes/FlowNode.tsxpackages/web/src/components/nodes/NodeBuilding.tsx
The 61-node type-variants showcase flow felt sluggish on pan/zoom. Two root causes; both fixed here. 1. FlowNodeComponent wasn't memoized. React Flow doesn't auto-memo custom node components, so every viewport tick from pan/zoom (which fires store updates) re-renders all visible nodes. With 60+ nodes that reconciler churn dominates the frame budget. Wrap the inner function in React.memo. FlowCanvas's `nodes` useMemo already keeps `data` references stable across viewport changes (its deps exclude viewport state), so the shallow-equal short circuit kicks in. 2. SVG sprites re-rasterize per zoom level. `image-rendering: pixelated` keeps it nearest-neighbor *after* rasterization, but with vector source the browser still walks the SVG DOM at each new size. On the type-variants flow the larger sprites (k8s_node 368 KB, scheduler 339 KB, docker 313 KB) are noticeable. Add `will-change: transform; transform: translate3d(0,0,0)` to the sprite wrapper so it's promoted to its own compositor layer. The rasterized image is cached once; subsequent zoom transforms become pure compositor work — no CPU re-raster per frame. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d8f0d67 to
d7799ed
Compare
…test - @openhop/server: 0.1.0-beta.2 → 0.1.0 - @openhop/web: 0.1.0-beta.4 → 0.1.0 - openhop CLI: 0.1.0-beta.6 → 0.1.0 + bump pinned @openhop/server, @openhop/web deps + hardcoded --version publish.yml: drop `--tag beta` from all three publish steps. With no --tag, `npm publish` sets the `latest` dist-tag — so npmjs.com pages and `npm install <pkg>` (no @beta suffix) automatically reflect the new version on every successful publish. No more manual `npm dist-tag add latest` step. Bundles 13 PRs since v0.1.0-beta.6: Web (heavy): - #106 sprite URLs use Vite BASE_URL (Pages 404 fix) - #107 example flow cards on empty state - #108 sidebar + carrot-click highlight for string-data steps - #109 all 5 examples grouped under examples/ + first-visit autoload - #112 per-step auto-zoom + playback speed button - #113 collapse FLOWS / INSPECT by default on mobile - #114 lazy editor + vendor-split chunks + meta description - #115 filter codemirror from <modulepreload> - #117 memo FlowNode + GPU-layer sprites for smoother pan/zoom CLI: - #116 OpenSkills fallback hint when no Tier-1 client gets the skill - #118 suppress the hint when Tier-1 already has the skill Server: untouched code; bumped to keep the 0.1.0 set consistent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…test (#119) - @openhop/server: 0.1.0-beta.2 → 0.1.0 - @openhop/web: 0.1.0-beta.4 → 0.1.0 - openhop CLI: 0.1.0-beta.6 → 0.1.0 + bump pinned @openhop/server, @openhop/web deps + hardcoded --version publish.yml: drop `--tag beta` from all three publish steps. With no --tag, `npm publish` sets the `latest` dist-tag — so npmjs.com pages and `npm install <pkg>` (no @beta suffix) automatically reflect the new version on every successful publish. No more manual `npm dist-tag add latest` step. Bundles 13 PRs since v0.1.0-beta.6: Web (heavy): - #106 sprite URLs use Vite BASE_URL (Pages 404 fix) - #107 example flow cards on empty state - #108 sidebar + carrot-click highlight for string-data steps - #109 all 5 examples grouped under examples/ + first-visit autoload - #112 per-step auto-zoom + playback speed button - #113 collapse FLOWS / INSPECT by default on mobile - #114 lazy editor + vendor-split chunks + meta description - #115 filter codemirror from <modulepreload> - #117 memo FlowNode + GPU-layer sprites for smoother pan/zoom CLI: - #116 OpenSkills fallback hint when no Tier-1 client gets the skill - #118 suppress the hint when Tier-1 already has the skill Server: untouched code; bumped to keep the 0.1.0 set consistent. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 61-node `type-variants` showcase flow felt sluggish on pan/zoom. Two root causes, both fixed here.
1. `FlowNodeComponent` was not memoized
React Flow doesn't auto-memo custom node components, so every viewport store-update from pan/zoom re-renders every visible node. With 60+ nodes the reconciler churn dominates the frame budget.
`memo()` short-circuits on shallow-equal `data`. FlowCanvas's `nodes` useMemo already keeps `data` references stable across viewport changes (its deps list excludes viewport state), so this lands correctly.
2. SVG sprites re-rasterize per zoom level
`image-rendering: pixelated` keeps it nearest-neighbor after rasterization, but with a vector source the browser still walks the SVG at each new output size. The largest sprites are heavy in source form (k8s 368 KB, scheduler 339 KB, docker 313 KB).
Adds `will-change: transform; transform: translate3d(0, 0, 0)` to the sprite wrapper. The rasterized image is promoted to its own compositor layer and cached; subsequent zoom transforms become pure compositor work — no CPU re-raster per frame.
Downsides (you asked)
memo:
GPU layer per sprite:
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit