fix(workflow-block): exclude trigger-advanced subblocks from canvas preview outside trigger mode#4969
Conversation
…review outside trigger mode
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Canvas preview ( Adds a regression test in Reviewed by Cursor Bugbot for commit 626cd78. Configure here. |
Greptile SummaryThis PR fixes a UI bug where switching the Table block's table field to "advanced" (manual) mode caused a duplicate "Table ID" row to appear in the canvas block preview. The root cause was that the canvas filter and autolayout row estimator only excluded
Confidence Score: 5/5Safe to merge — the change is a targeted two-site substitution replacing an incomplete mode check with the canonical helper, backed by a new regression test that fails without the fix. Both changed call sites in workflow-block.tsx and autolayout/utils.ts are straightforward replacements of block.mode === 'trigger' with the already-existing isTriggerModeSubBlock helper, which has been in use in the editor sidebar. The fix is consistent across canvas preview and autolayout estimation. The new test exercises the exact failure scenario described in the PR and correctly asserts height parity between basic and advanced modes. No new state management, API calls, or side effects are introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Block subBlocks config spread\nfrom trigger definition] --> B{effectiveTrigger?}
B -- Yes --> C{isPureTriggerBlock?}
C -- Yes --> D["isTriggerModeSubBlock(block)\nOR !block.mode"]
C -- No --> E["isTriggerModeSubBlock(block)"]
D -- false --> F[Exclude from canvas preview]
E -- false --> F
D -- true --> G[Keep - proceed to mode/condition checks]
E -- true --> G
B -- No --> H["isTriggerModeSubBlock(block)\n= mode==='trigger' OR mode==='trigger-advanced'"]
H -- true --> F
H -- false --> G
G --> I["isSubBlockVisibleForMode()"]
I -- visible --> J["evaluateSubBlockCondition()"]
J -- pass --> K[Render row in canvas preview]
I -- not visible --> F
J -- fail --> F
style F fill:#f96,stroke:#c00
style K fill:#6c6,stroke:#060
Reviews (1): Last reviewed commit: "fix(workflow-block): exclude trigger-adv..." | Re-trigger Greptile |
Summary
table_new_rowtrigger's subBlocks, which include a secondmanualTableIdwithmode: 'trigger-advanced'; the canvas preview filter only excludedmode === 'trigger', so the trigger copy leaked through and rendered a second rowisTriggerModeSubBlockhelper (covers bothtriggerandtrigger-advanced), matching the editor sidebar'sisSubBlockVisibleForTriggerModebehaviorType of Change
Testing
bunx tsc --noEmitand existing autolayout/visibility tests passChecklist