Skip to content

Commit ed36158

Browse files
committed
Add sync status polling for idle updates
- Poll every 3 seconds to re-fetch sync status for paths already in syncStatusMap - Only polls when pane is focused and has a listing - Ensures iCloud/Dropbox sync icons update in real time even when the user is not scrolling
1 parent 9150ee5 commit ed36158

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

apps/desktop/src/lib/file-explorer/pane/FilePane.svelte

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@
328328
let unlistenReadComplete: UnlistenFn | undefined
329329
// Sync status map for visible files
330330
let syncStatusMap = $state<Record<string, SyncStatus>>({})
331+
const syncPollIntervalMs = 3000
332+
let syncPollInterval: ReturnType<typeof setInterval>
331333
332334
// Derive includeHidden from showHiddenFiles prop
333335
const includeHidden = $derived(showHiddenFiles)
@@ -1165,6 +1167,12 @@
11651167
log.debug('[FilePane] onMount: SKIPPING loadDirectory for paneId={paneId}', { paneId })
11661168
}
11671169
1170+
// Poll sync status so iCloud/Dropbox icons update while idle
1171+
syncPollInterval = setInterval(() => {
1172+
const paths = Object.keys(syncStatusMap)
1173+
if (!listingId || !isFocused || paths.length === 0) return
1174+
void fetchSyncStatusForPaths(paths)
1175+
}, syncPollIntervalMs)
11681176
})
11691177
11701178
onDestroy(() => {
@@ -1173,6 +1181,7 @@
11731181
void cancelListing(listingId)
11741182
void listDirectoryEnd(listingId)
11751183
}
1184+
clearInterval(syncPollInterval)
11761185
unlistenOpening?.()
11771186
unlistenProgress?.()
11781187
unlistenReadComplete?.()

0 commit comments

Comments
 (0)