Uh oh!
There was an error while loading. Please reload this page.
improvement(workflow): narrow zustand selectors and optimize log tree builds - #4378
Conversation
… builds - Add useIsCurrentWorkflowExecuting selector; swap broad useCurrentWorkflowExecution in action-bar/chat - Use useShallow for execution-state subset in useWorkflowExecution - Drop useCallback-wrapped object selectors in diff-controls and use-block-state (use primitive selectors) - Stabilize EMPTY_SUBBLOCK_VALUES constant for empty-workflow selector results in api-info-modal, mcp, tag-dropdown - O(n) Map lookups in buildEntryTree (was O(n^2) filter scans) - Skip expanded-paths reset when structured-output data is content-stable - Extract ReactFlow constants out of workflow.tsx into workflow-constants.ts
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Improves terminal/output performance by optimizing Extracts ReactFlow configuration constants from Reviewed by Cursor Bugbot for commit c7dab39. Configure here. |
Greptile SummaryThis PR improves rendering performance in several areas: it introduces Confidence Score: 5/5This PR is safe to merge — all changes are purely additive optimisations with no behavioral regressions. No P0 or P1 findings. Every change either narrows a Zustand selector, replaces a no-op pattern with a correct one, or improves algorithmic complexity. The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Execution Store
A[workflowExecutions Map]
B[useCurrentWorkflowExecution\nreturns full WorkflowExecutionState]
C[useIsCurrentWorkflowExecuting\nreturns boolean only]
end
subgraph Consumers
E[action-bar.tsx]
F[chat.tsx]
G[use-workflow-execution.ts\nuseShallow 5-field slice]
end
A -->|"full object — re-renders on\nevery iteration update"| B
A -->|"boolean — re-renders only\nwhen isExecuting flips"| C
A -->|"useShallow — re-renders only\nwhen any of 5 fields changes"| G
C --> E
C --> F
Reviews (3): Last reviewed commit: "chore(ci): bump api-validation route bas..." | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…UBBLOCK_VALUES - Use null sentinel for prevDataJsonRef and lazily stringify prevDataRef on first compare so the optimization holds on the first stream refresh after mount - Export EMPTY_SUBBLOCK_VALUES from the subblock store; remove three duplicated module constants
waleedlatif1
commented
May 1, 2026
waleedlatif1
commented
May 1, 2026
@cursor review |
PR #4373 added apps/sim/app/api/table/[tableId]/export/route.ts but didn't update the audit baseline, so unrelated PRs fail check:api-validation:strict. Bump baseline to match current route count.
There was a problem hiding this comment.
✅ 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 b152392. Configure here.
waleedlatif1
commented
May 1, 2026
waleedlatif1
commented
May 1, 2026
@cursor review |
There was a problem hiding this comment.
✅ 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 c7dab39. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Summary
useIsCurrentWorkflowExecutingselector; swap broaduseCurrentWorkflowExecutionin action-bar/chat (was re-rendering on every iteration update)useShallowfor execution-state subset inuseWorkflowExecutionuseCallback-wrapped object selectors indiff-controlsanduse-block-state— primitive selectors instead (theuseCallbackdid nothing for Zustand reference equality, which was the bug)EMPTY_SUBBLOCK_VALUESmodule constant for empty-workflow selector results in api-info-modal, mcp deploy, tag-dropdownbuildEntryTree(was O(n²) filter scans — relevant for 100+ iteration parallel-loop logs)workflow.tsxintoworkflow-constants.tsType of Change
Testing
Tested manually. Behavior is preserved across all changes — selectors return the same values,
useShallow/primitive selectors read the same fields, Map iteration preserves insertion order, JSON short-circuit only narrows when the existing reset would have fired.Checklist