Skip to content

fix(kb): show 'pending' instead of past date for overdue next sync#4039

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-kb-next-sync
Apr 8, 2026
Merged

fix(kb): show 'pending' instead of past date for overdue next sync#4039
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/fix-kb-next-sync

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • When a connector's nextSyncAt is in the past (sync overdue / cron delayed), the UI was showing "Next sync: 2 days ago" via formatDistanceToNow. Now shows "Next sync: pending" instead.

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)

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 8, 2026

PR Summary

Low Risk
Low risk UI-only change that alters how nextSyncAt is displayed when the scheduled time is in the past; no backend or data-flow behavior changes.

Overview
Updates the connectors list UI to treat overdue nextSyncAt values as pending rather than rendering a relative past time (e.g., "2 days ago"). This uses date-fns isPast to conditionally switch the "Next sync" label for active connectors.

Reviewed by Cursor Bugbot for commit 7abb202. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 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 8, 2026 5:24am

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 8, 2026

Greptile Summary

This PR fixes a UX bug in the knowledge base connectors section where nextSyncAt dates in the past (i.e., syncs that are overdue due to cron delay) were being displayed as relative past timestamps (e.g., "Next sync: 2 days ago") instead of a meaningful pending state indicator.

Changes:

  • Imports isPast from date-fns alongside the existing format and formatDistanceToNow imports.
  • Wraps the formatDistanceToNow call in a ternary: if the nextSyncAt date is already in the past, renders the string "pending" instead of the misleading relative timestamp.

Confidence Score: 5/5

Safe to merge — single-file, display-only change with correct logic.

The change is minimal, targeted, and correct. isPast from date-fns reliably detects overdue dates, and the only remaining finding is a P2 style suggestion about a redundant new Date() construction that has no impact on correctness or performance at this scale.

No files require special attention.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/connectors-section/connectors-section.tsx Adds isPast guard so overdue nextSyncAt displays "pending" instead of a past-relative timestamp; logic is correct and minimal.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ConnectorCard renders next sync info] --> B{connector.nextSyncAt && status === 'active'?}
    B -- No --> C[No next sync shown]
    B -- Yes --> D{isPast nextSyncAt ?}
    D -- Yes overdue --> E["Show: 'Next sync: pending'"]
    D -- No future --> F["Show: 'Next sync: in X minutes/hours'"]
Loading

Reviews (1): Last reviewed commit: "fix(kb): show 'pending' instead of past ..." | Re-trigger Greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

Re: double new Date() instantiation — Ack. Considered both approaches (IIFE and extracted const). The double new Date() is sub-microsecond and this renders once per connector card, so the readability tradeoff isn't worth it here. Keeping as-is.

@waleedlatif1 waleedlatif1 merged commit 7b81a76 into staging Apr 8, 2026
12 checks passed
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