Skip to content

fix(trigger): show selector display names on canvas for trigger file/sheet selectors#4097

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/trigger-selector-display-names
Apr 10, 2026
Merged

fix(trigger): show selector display names on canvas for trigger file/sheet selectors#4097
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/trigger-selector-display-names

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes trigger block canvas preview showing '-' for file-selector and sheet-selector fields even when values are selected
  • Root cause 1: `resolveDependencyValue` only checked `group.basicId` and `group.advancedIds` when resolving a canonical group, missing trigger-mode subblocks (e.g. `triggerCredentials`) that are registered in `canonicalIdBySubBlockId` but deliberately excluded from the group struct to avoid corrupting regular block canonical groups — added a fallback scan over all registered canonical members
  • Root cause 2: `credentialId` in `SubBlockRow` was read from `dependencyValues.credential`, but trigger subblocks use `triggerCredentials` as their dep key so `dependencyValues.credential` was always undefined — now falls back to `resolveContextValue('oauthCredential')` which finds the credential via the extended canonical resolution

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 9:16pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 10, 2026

PR Summary

Low Risk
Low risk bug fix confined to dependency/canonical resolution and canvas display-name hydration; main risk is unintended fallback matching returning the wrong member value for a canonical group in edge cases.

Overview
Fixes trigger-mode selector fields (e.g. file/sheet selectors) showing - on the workflow canvas by improving how dependency values are resolved and passed to display-name hydration.

resolveDependencyValue now falls back to scanning all subblocks registered under the same canonical id when the canonical group’s basic/advanced ids don’t produce a value (covers trigger-only members). SubBlockRow now derives credentialId from dependencyValues.credential or the resolved oauthCredential context so useSelectorDisplayName can hydrate trigger selectors correctly.

Reviewed by Cursor Bugbot for commit 5d6bc86. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR fixes the canvas preview for trigger blocks showing - for file-selector and sheet-selector fields when values are already selected. It addresses two root causes: a missing fallback in resolveDependencyValue for trigger-mode subblocks that are intentionally excluded from canonical group structs, and credentialId always resolving to undefined for trigger subblocks that use triggerCredentials rather than credential as their dep key.

Confidence Score: 4/5

Safe to merge with one minor inconsistency: the != null guard preceding the new fallback scan can bypass it when the basic subblock holds an empty string, so the fix may not fire in cleared-field edge cases.

Both root causes are correctly diagnosed and the fixes are targeted. The previous thread concern (using isNonEmptyValue in the scan body) was already resolved. The remaining P2 item — the != null guard on line 290 vs. isNonEmptyValue used everywhere else — is a real inconsistency that could silently suppress the fallback in the empty-string edge case, so a score of 4 rather than 5 reflects that a one-line follow-up is worth making.

apps/sim/lib/workflows/subblocks/visibility.ts — line 290 guard inconsistency

Important Files Changed

Filename Overview
apps/sim/lib/workflows/subblocks/visibility.ts Adds a fallback scan over canonicalIdBySubBlockId in resolveDependencyValue for trigger-mode subblocks excluded from the canonical group struct. The scan correctly uses isNonEmptyValue, but the preceding guard on line 290 still uses != null, which can short-circuit the scan when basicValue is an empty string.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx Adds ?? resolveContextValue('oauthCredential') fallback for credentialId so trigger subblocks that use triggerCredentials (not credential) as their dep key still resolve the credential for selector display-name lookups. Clean and targeted fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["resolveDependencyValue(oauthCredential)"] --> B{canonicalId found?}
    B -- No --> C[return values at dependencyKey]
    B -- Yes --> D["getCanonicalValues(group, values)"]
    D --> E["canonicalResult = basicValue OR advancedValue"]
    E --> F{"canonicalResult != null\ncurrently uses != null not isNonEmptyValue"}
    F -- Yes --> G[return canonicalResult]
    F -- No --> H["Fallback scan over canonicalIdBySubBlockId"]
    H --> I{"memberId maps to canonicalId AND isNonEmptyValue?"}
    I -- Yes --> J["return trigger credential value"]
    I -- No --> K[return values at dependencyKey]

    style F fill:#f9c,stroke:#c33
    style J fill:#9f9,stroke:#393
Loading

Reviews (2): Last reviewed commit: "fix(trigger): use isNonEmptyValue in can..." | Re-trigger Greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

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 5d6bc86. Configure here.

@waleedlatif1 waleedlatif1 merged commit 59de6bb into staging Apr 10, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/trigger-selector-display-names branch April 10, 2026 21:24
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