Skip to content

fix(trigger): resolve dependsOn for trigger-mode subblocks sharing canonical groups with block subblocks#4095

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/trigger-dependson-fix
Apr 10, 2026
Merged

fix(trigger): resolve dependsOn for trigger-mode subblocks sharing canonical groups with block subblocks#4095
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/trigger-dependson-fix

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes dependsOn gating for trigger-mode subblocks (e.g. Google Sheets spreadsheet picker stays disabled after selecting credentials)
  • Root cause: resolveDependencyValue resolves trigger subblock IDs through the canonical group from the full block definition, where the group's basicId is the regular block's subblock ID (e.g. credential), not the trigger's subblock ID (e.g. triggerCredentials) — so values['credential'] is always undefined in trigger mode
  • Fix: after canonical resolution, fall back to values[dependencyKey] when the canonical result is null/undefined — covers the case where the dependency key is a trigger-mode subblock that participates in a canonical group but isn't registered as the group's basicId or advancedId
  • All existing blocks unaffected: the fallback only triggers when canonical resolution returns nothing, which doesn't happen for regular block subblocks where the dependencyKey IS the group's basicId

Type of Change

  • Bug fix

Testing

Tested manually

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
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 10, 2026 7:44pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 10, 2026

PR Summary

Low Risk
Low risk, small change to resolveDependencyValue that only alters behavior when canonical resolution yields null/undefined, primarily affecting dependsOn gating/visibility for trigger-mode subblocks in canonical groups.

Overview
Fixes dependsOn gating for trigger-mode subblocks that share canonical groups with block subblocks by updating resolveDependencyValue to fall back to values[dependencyKey] when the canonically-resolved value is null/undefined.

This prevents trigger fields from staying disabled when their IDs aren’t the canonical group’s basicId/advancedId, while leaving normal canonical swaps unchanged when they successfully resolve a value.

Reviewed by Cursor Bugbot for commit bb721c9. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR fixes a dependsOn gating regression for trigger-mode subblocks (e.g. Google Sheets spreadsheetId picker staying disabled after selecting credentials). The root cause was that resolveDependencyValue resolved triggerCredentials through the canonical group (oauthCredential), whose basicId is the regular block's credential subblock — so values['credential'] is always undefined in trigger mode, causing the resolved value to be undefined and the downstream field to remain disabled.

The fix is a one-line ?? values[dependencyKey] fallback: if canonical resolution returns nothing (null/undefined), fall back to the raw value for the dependency key itself. This correctly handles the trigger case without affecting regular block behavior, since canonical resolution only returns null/undefined when basicId and all advancedIds are empty in the current values — a state that can only arise when the dependency key is a trigger-mode subblock that isn't the group's basicId.

Confidence Score: 5/5

Safe to merge — targeted one-line fix with no regression risk for regular blocks.

The change is a single nullish-coalescing fallback in resolveDependencyValue. The fallback only activates when canonical resolution returns null/undefined, which only happens when the dependency key is a trigger-mode subblock not registered as basicId in its canonical group. For all regular block subblocks the canonical result is always the actual stored value, so the fallback never fires. No P0/P1 findings were identified.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/workflows/subblocks/visibility.ts Adds a nullish-coalescing fallback in resolveDependencyValue so trigger-mode subblock IDs that participate in a canonical group but aren't registered as the group's basicId resolve correctly to their raw value.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["resolveDependencyValue(dependencyKey, values, canonicalIndex)"] --> B{canonicalId found?}
    B -- No --> C["return values[dependencyKey]"]
    B -- Yes --> D{group found?}
    D -- No --> C
    D -- Yes --> E["getCanonicalValues(group, values)"]
    E --> F["resolveCanonicalMode(group, values, overrides)"]
    F --> G{"mode === 'advanced'?"}
    G -- Yes --> H["canonicalResult = advancedValue ?? basicValue"]
    G -- No --> I["canonicalResult = basicValue ?? advancedValue"]
    H --> J{canonicalResult null/undefined?}
    I --> J
    J -- No --> K["return canonicalResult"]
    J -- Yes --> L["return values[dependencyKey]"]
    L --> M["Trigger mode: returns values['triggerCredentials']"]
Loading

Reviews (1): Last reviewed commit: "fix(trigger): resolve dependsOn for trig..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 2b9fb19 into staging Apr 10, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/trigger-dependson-fix branch April 10, 2026 19:50
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.

1 participant