Skip to content

Commit b717ed4

Browse files
authored
Merge pull request #865 from airweave-ai/fix/make-last-sync-not-display-never
fix: no display of never
2 parents fda2a8c + 644b914 commit b717ed4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

frontend/src/components/collection/SourceConnectionStateView.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const SourceConnectionStateView: React.FC<Props> = ({
116116
}) => {
117117
const [isInitializing, setIsInitializing] = useState(true);
118118
const [sourceConnection, setSourceConnection] = useState<SourceConnection | null>(sourceConnectionData || null);
119-
const [lastRanDisplay, setLastRanDisplay] = useState<string>('Never');
119+
const [lastRanDisplay, setLastRanDisplay] = useState<string | null>(null);
120120
const [isRefreshingAuth, setIsRefreshingAuth] = useState(false);
121121

122122
// Track if we initiated a cancellation (for timeout handling)
@@ -144,7 +144,7 @@ const SourceConnectionStateView: React.FC<Props> = ({
144144

145145
// Format time ago display
146146
const formatTimeAgo = useCallback((dateStr: string | undefined) => {
147-
if (!dateStr) return 'Never';
147+
if (!dateStr) return null; // Return null instead of 'Never'
148148

149149
// CRITICAL: Backend sends naive datetime strings WITHOUT timezone
150150
// These are actually UTC times but JavaScript interprets them as LOCAL time by default!
@@ -176,7 +176,7 @@ const SourceConnectionStateView: React.FC<Props> = ({
176176

177177
// Format exact timestamp for tooltip
178178
const formatExactTime = useCallback((dateStr: string | undefined) => {
179-
if (!dateStr) return 'Never';
179+
if (!dateStr) return null;
180180

181181
// Backend sends naive datetime strings that are actually UTC
182182
// We need to interpret them as UTC, not local time
@@ -351,7 +351,7 @@ const SourceConnectionStateView: React.FC<Props> = ({
351351
const updateLastRan = () => {
352352
// Don't show "Running now" - let the status badge handle that
353353
const startedAt = storeConnection?.last_sync_job?.started_at || sourceConnection?.last_sync_job?.started_at;
354-
setLastRanDisplay(startedAt ? formatTimeAgo(startedAt) : 'Never');
354+
setLastRanDisplay(formatTimeAgo(startedAt));
355355
};
356356

357357
updateLastRan();
@@ -715,8 +715,8 @@ const SourceConnectionStateView: React.FC<Props> = ({
715715
</Tooltip>
716716
</TooltipProvider>
717717

718-
{/* Last Sync Card - Only show when not actively syncing */}
719-
{!(isRunning || isPending || isCancellingStatus) && (
718+
{/* Last Sync Card - Only show when not actively syncing AND there's sync history */}
719+
{!(isRunning || isPending || isCancellingStatus) && lastRanDisplay && (
720720
<TooltipProvider delayDuration={100}>
721721
<Tooltip>
722722
<TooltipTrigger asChild>

0 commit comments

Comments
 (0)