Skip to content

fix(knowledge): show spinner on connector chip while syncing#3808

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/connector-syncing-spinner
Mar 27, 2026
Merged

fix(knowledge): show spinner on connector chip while syncing#3808
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/connector-syncing-spinner

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add spinner next to connector name when actively syncing
  • Uses per-connector syncCooldown instead of global isSyncing so only the triggered connector shows the spinner
  • Removed duplicate spinner from status badge — name spinner + amber label is sufficient

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 Mar 27, 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 27, 2026 6:48pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 27, 2026

PR Summary

Low Risk
Low risk UI/state change limited to connector sync feedback; main risk is minor UX regressions if the per-connector pending state is not cleared correctly on errors/success.

Overview
Improves connector sync UX by tracking a per-connector pending state (syncingConnectorId) when a manual sync is triggered, so only that connector shows a spinner while the trigger request is in flight.

Moves the spinner indicator to appear next to the connector name (and also when status === 'syncing') and removes the duplicate spinner from the status Badge.

Written by Cursor Bugbot for commit 559ad58. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 27, 2026

Greptile Summary

This PR fixes the connector sync spinner so it only appears on the connector that was manually triggered, rather than relying on the global isSyncing flag or the 5-minute syncCooldown. It introduces a syncingConnectorId state scoped to the mutation lifetime (set before triggerSync fires, cleared in onSuccess/onError), passes it as isSyncPending to each ConnectorCard, and moves the spinner from the status badge into the connector name row.\n\nKey changes:\n- New syncingConnectorId: string | null state in ConnectorsSection, set/cleared around the triggerSync mutation call.\n- isSyncPending prop added to ConnectorCardProps and used in the spinner condition alongside connector.status === 'syncing' — the first covers the API round-trip, the second covers the server-side sync duration.\n- Spinner removed from inside the <Badge> for the status label; the amber Syncing badge alone communicates status once the API call resolves.

Confidence Score: 5/5

Safe to merge — targeted, well-scoped UI fix with no logic regressions.

The change is minimal and correct: syncingConnectorId is set immediately before the mutation and cleared in both onSuccess and onError, so no leaked state. The spinner condition (isSyncPending || connector.status === 'syncing') correctly covers both the API round-trip window and the server-side sync duration. The sync button's disabled guard (isSyncing) still prevents triggering a second sync while one is in-flight, so the race-condition path where two connectors could both set syncingConnectorId is unreachable. All prior P1 feedback (spinner persisting for the 5-minute cooldown) has been resolved. No remaining P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/connectors-section/connectors-section.tsx Adds per-connector syncingConnectorId state to scope the spinner to the triggered connector's mutation lifetime; removes spinner from the status badge; spinner still shown when connector.status === 'syncing' (server-side). Clean fix addressing the prior syncCooldown feedback.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant CC as ConnectorCard
    participant CS as ConnectorsSection
    participant API as triggerSync mutation

    U->>CC: clicks Sync button
    CC->>CS: onSync(connectorId)
    CS->>CS: setSyncingConnectorId(connectorId)
    CS->>API: triggerSync({ knowledgeBaseId, connectorId })
    CS-->>CC: isSyncPending=true → Loader2 shown next to name
    Note over CC: connector.status still 'active'

    API-->>CS: onSuccess
    CS->>CS: setSyncingConnectorId(null)
    Note over CC: isSyncPending=false, spinner hides
    Note over CC: connector.status transitions to 'syncing'
    CC-->>CC: connector.status==='syncing' → spinner shown again
    Note over CC: Badge shows 'Syncing' (amber)

    Note over CC: Server finishes sync
    CC-->>CC: connector.status==='active' → spinner hidden
    Note over CC: Badge shows 'Active' (green)
Loading

Reviews (2): Last reviewed commit: "fix(knowledge): scope sync spinner to mu..." | 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

@waleedlatif1 waleedlatif1 merged commit a489f91 into staging Mar 27, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/connector-syncing-spinner branch March 27, 2026 19:04
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