Skip to content

fix(editor): pass workspaceId to useCredentialName in block preview#3418

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-credential-preview
Mar 5, 2026
Merged

fix(editor): pass workspaceId to useCredentialName in block preview#3418
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-credential-preview

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Fix credential names not showing in block preview on canvas
  • Pass workspaceId to useCredentialName so it shares the same React Query cache key as the editor panel

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 Mar 5, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 5, 2026 2:10am

Request Review

@cursor
Copy link

cursor bot commented Mar 5, 2026

PR Summary

Low Risk
Low risk bug fix confined to the canvas block preview: it only changes the parameters used for the credential-name query/cache key, affecting display but not credential data writes or auth.

Overview
Fixes credential display names not resolving in the canvas block preview by passing workspaceId into useCredentialName from workflow-block.tsx, aligning the React Query cache key with the editor panel and ensuring the same credential list is reused.

Written by Cursor Bugbot for commit 1d7a9ae. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 5, 2026

Greptile Summary

This is a targeted, one-line bug fix that passes workspaceId to the useCredentialName hook inside SubBlockRow. Previously, the hook was called without workspaceId, producing a cache key of ['oauthCredentials', providerId, 'none', workflowId], while the editor panel used the full ['oauthCredentials', providerId, workspaceId, workflowId] key. Because the two cache entries were different, the block canvas preview never picked up the already-fetched credentials, leaving credential names blank.

Key points:

  • workspaceId was already available as a prop on SubBlockRow and already passed at the call site (line 1412)
  • useCredentialName already accepted workspaceId as its optional fourth parameter and forwarded it to useOAuthCredentials, which includes it in the query key
  • The fix is limited in scope and has no unintended side-effects — it only aligns the cache key used during canvas block-preview rendering with the one used in the editor panel

Confidence Score: 5/5

  • This PR is safe to merge — the change is a single-line, well-scoped bug fix with no risk of regressions.
  • The fix correctly threads the already-available workspaceId prop through to the useCredentialName hook call, aligning React Query cache keys between the editor panel and block preview. There are no new API calls, no new state management, no behavioral changes beyond the intended fix, and all required props are already in scope. The hook already accepted this parameter and properly forwards it to the query key construction.
  • No files require special attention

Sequence Diagram

sequenceDiagram
    participant EditorPanel as Editor Panel
    participant BlockPreview as Block Preview (SubBlockRow)
    participant useCredentialName
    participant ReactQuery as React Query Cache
    participant API as /api/auth/oauth/credentials

    EditorPanel->>useCredentialName: useCredentialName(credId, providerId, workflowId, workspaceId)
    useCredentialName->>ReactQuery: queryKey: ['oauthCredentials', providerId, workspaceId, workflowId]
    ReactQuery-->>API: fetch (cache miss)
    API-->>ReactQuery: credentials[]
    ReactQuery-->>useCredentialName: credentials[]
    useCredentialName-->>EditorPanel: displayName

    Note over BlockPreview: Before fix: missing workspaceId
    BlockPreview->>useCredentialName: useCredentialName(credId, providerId, workflowId, undefined)
    useCredentialName->>ReactQuery: queryKey: ['oauthCredentials', providerId, 'none', workflowId]
    ReactQuery-->>API: fetch (different key → cache miss)
    API-->>ReactQuery: credentials[]
    ReactQuery-->>useCredentialName: credentials[]
    useCredentialName-->>BlockPreview: displayName (blank on initial load)

    Note over BlockPreview: After fix: workspaceId passed
    BlockPreview->>useCredentialName: useCredentialName(credId, providerId, workflowId, workspaceId)
    useCredentialName->>ReactQuery: queryKey: ['oauthCredentials', providerId, workspaceId, workflowId]
    ReactQuery-->>BlockPreview: credentials[] (cache hit ✓)
    useCredentialName-->>BlockPreview: displayName (correct)
Loading

Last reviewed commit: 1d7a9ae

@waleedlatif1 waleedlatif1 merged commit 115b458 into staging Mar 5, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/fix-credential-preview branch March 5, 2026 02:15
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