Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

  • Google Drive Picker should auto populate folder names, etc.
  • dependsOn for poller trigger subblocks

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

vercel bot commented Nov 11, 2025

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

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Nov 11, 2025 9:38pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 11, 2025

Greptile Overview

Greptile Summary

This PR fixes Google Drive Picker hydration issues and implements dependsOn gating for trigger sub-blocks.

Key Changes:

  • Display Name Hydration: Google Drive file/folder selections now properly cache and retrieve display names, preventing IDs from showing instead of human-readable names
  • Placeholder Handling: Added - placeholder for selector types while display names are being fetched, improving UX during hydration
  • DependsOn Gating: Trigger sub-blocks (Gmail labels, Outlook folders) now respect dependsOn declarations, disabling dependent fields until credentials are selected
  • Error Handling: Changed trigger fetchOptions to throw errors instead of returning empty arrays, preventing infinite retry loops when credentials are missing
  • Credential Validation: Added logic to detect and clear invalid credential selections when credentials are disconnected

Technical Implementation:

  • Introduced SELECTOR_TYPES_HYDRATION_REQUIRED constant to identify selector types needing name resolution
  • Extended useDisplayName hook with Google Drive file fetching via /api/tools/drive/file
  • Added removeDisplayName method to display names store for cleanup
  • Integrated useDependsOnGate hook in sub-block component to compute disabled state based on dependencies

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes follow established patterns and fix real user-facing issues. The hydration logic properly caches display names, the dependsOn gating prevents invalid states, and error handling improvements stop infinite retry loops. Code quality is high with proper type safety and no security concerns.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/file-selector/components/google-drive-picker.tsx 5/5 Added display name caching for selected files/folders to fix hydration issues
apps/sim/hooks/use-display-name.ts 5/5 Added Google Drive file/folder fetching by ID for proper display name hydration
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx 5/5 Added selector type detection to show "-" placeholder while hydrating display names
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/sub-block.tsx 5/5 Integrated useDependsOnGate hook to respect dependsOn declarations for sub-blocks
apps/sim/triggers/gmail/poller.ts 5/5 Added dependsOn for labels selector and changed to throw errors instead of returning empty arrays
apps/sim/triggers/outlook/poller.ts 5/5 Added dependsOn for folders selector and changed to throw errors instead of returning empty arrays

Sequence Diagram

sequenceDiagram
    participant User
    participant SubBlock
    participant DependsOnGate
    participant GoogleDrivePicker
    participant DisplayNameStore
    participant UseDisplayName
    participant API
    
    User->>SubBlock: Open workflow block
    SubBlock->>DependsOnGate: Check dependencies (triggerCredentials)
    DependsOnGate-->>SubBlock: Return disabled state
    
    User->>SubBlock: Select credential
    SubBlock->>DependsOnGate: Re-check dependencies
    DependsOnGate-->>SubBlock: Dependencies satisfied, enable
    
    User->>GoogleDrivePicker: Select file/folder
    GoogleDrivePicker->>DisplayNameStore: Cache file name (setDisplayNames)
    GoogleDrivePicker->>SubBlock: Return file info
    
    User->>SubBlock: Reload workflow
    SubBlock->>UseDisplayName: Request display name
    UseDisplayName->>DisplayNameStore: Check cache
    alt Cache hit
        DisplayNameStore-->>UseDisplayName: Return cached name
    else Cache miss
        UseDisplayName->>API: Fetch file by ID
        API-->>UseDisplayName: Return file data
        UseDisplayName->>DisplayNameStore: Cache name
        DisplayNameStore-->>UseDisplayName: Return name
    end
    UseDisplayName-->>SubBlock: Display hydrated name
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

10 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 merged commit f00d551 into staging Nov 11, 2025
9 checks passed
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
…sOn for trigger subblocks (#1901)

* fix(google-drive-picker): hydration issues with drive picker

* respect depends on gating

* add depends on for outlook polling

* remove useless file

* fix lint
waleedlatif1 pushed a commit that referenced this pull request Nov 12, 2025
…sOn for trigger subblocks (#1901)

* fix(google-drive-picker): hydration issues with drive picker

* respect depends on gating

* add depends on for outlook polling

* remove useless file

* fix lint
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
@waleedlatif1 waleedlatif1 deleted the fix/drive-picker branch November 18, 2025 01:28
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