Skip to content

fix(workflow): prevent canvas slowdown cascades - #6881

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/react-scan-csp
Aug 20, 2026
Merged

fix(workflow): prevent canvas slowdown cascades#6881
waleedlatif1 merged 3 commits into
stagingfrom
fix/react-scan-csp

Conversation

@j15z

@j15z j15z commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Stop held Left/Right arrow keys from repeatedly switching focused workflow blocks. A held key now produces one navigation step per physical key press instead of flooding selection and canvas updates.
  • Prevent React Flow measurement updates from cascading through the graph. Unchanged node dimensions and edges retain their existing references, and the measurement callback stays stable, so resizing one block does not make unrelated blocks rerender.
  • Keep expensive search work dormant while its UI is closed. The workflow search/replace panel and its queries mount only while open, and deferred search values keep typing responsive when a large catalog is available.
  • Make the connection picker fast without exposing pagination. It mounts 50 browse rows initially, automatically prefetches the next 50 before scrolling reaches the end, and performs those additions as low-priority updates. There is no Show more button or loading state, while search still ranks against the full catalog.

Type of Change

  • Bug fix

Testing

  • Tested manually with React Scan in Chrome
  • 191 focused tests passed for the original performance fixes
  • 43 connection-picker/search utility tests passed after the seamless-loading update
  • Repo-wide type-check passed
  • Repo-wide lint passed (13,986 files)
  • Block registry validation passed against staging
  • All 29 repository audits passed

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 20, 2026 3:30am

Request Review

@cursor

cursor Bot commented Aug 20, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit dc131b6. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR reduces workflow-editor render and input cascades while deferring expensive picker and search work.

  • Reconciles canvas nodes and edges to retain unchanged references and stabilizes measurement and deletion callbacks.
  • Prevents repeated arrow-key navigation from held keys.
  • Mounts workflow search only while open and adds seamless incremental loading to the connection picker.
  • Avoids constructing tool-picker groups while the combobox is closed.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Adopts reference-preserving canvas reconciliation, stable edge deletion state, and one-step-per-press keyboard navigation.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/search-replace/workflow-search-replace.tsx Splits the conditional panel mount from global command registration and restores reliable query focus for both closed and already-open states.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/connection-block-selector/connection-block-selector.tsx Adds deferred search and observer-driven incremental browse rendering while retaining full-catalog search.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-canvas-helpers.ts Adds reusable keyboard-direction and reference-reconciliation helpers for canvas state.
apps/sim/stores/workflows/workflow/store.ts Preserves existing graph references when dimension and edge updates do not materially change state.

Reviews (2): Last reviewed commit: "fix(workflow): correct two regressions i..." | Re-trigger Greptile

Gating `toolBlocks` on the picker's open state also emptied it for the
always-visible selected-tool chips, which silently fell through to their
`getBlock` fallback — the branch documented as the exception for types
hidden from the picker. Only `toolGroups`, where the expensive group build
lives, is gated now.

Re-invoking the find shortcut while the panel was already open stopped
re-selecting the query: `open()` is a no-op when the panel is mounted, so
the mount-time focus effect never re-ran. The panel publishes its focus
callback so the shortcut can drive it either way.

A saturated `slice` also allocated a fresh array once the limit covered a
whole group, re-rendering the memoized "All blocks" group on every tools
page-in — the frame cost the change set out to remove.

Alongside those: fold the two reconcilers into one generic and decide reuse
by identity rather than a three-write `changed` flag; record why the node
comparison is deliberately asymmetric (React Flow augments node objects in
place, so a symmetric `isEqual` would never reuse anything); give the
browse pagination its own constant instead of borrowing the search-result
cap; drop a redundant clamp and the deps it needed; inline the
single-consumer `sliceGroupsToLimit`; and split the bundled ref so the
hottest component stops allocating an object per render.
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 21f2022. Configure here.

@waleedlatif1
waleedlatif1 merged commit 9a621bc into staging Aug 20, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/react-scan-csp branch August 20, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants