From 5d89d81ca2ce33f8237c16beedb4bd6f15212097 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 28 Apr 2026 18:08:15 +0200 Subject: [PATCH] Always pass update_time cursor on SSE-driven history refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When SSE fires and refreshHistoryFromPush runs with force=true, we were passing undefined to loadCurrentHistory, refetching the history summary without the server-side `since` cursor. Always pass lastUpdateTime so the server can short-circuit when nothing changed; force=true now only bypasses the client-side `lastUpdateTime >= history.update_time` gate, not the cursor — items the client already has are not refetched. --- client/src/watch/watchHistory.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/watch/watchHistory.js b/client/src/watch/watchHistory.js index e99f8d5676e..523d3003163 100644 --- a/client/src/watch/watchHistory.js +++ b/client/src/watch/watchHistory.js @@ -58,8 +58,11 @@ async function _fetchHistoryAndChangedItems(app, { force }) { const collectionElementsStore = useCollectionElementsStore(); const checkForUpdate = new Date(); - // When forced, skip the `since` filter so the server always returns the history. - const history = await historyStore.loadCurrentHistory(force ? undefined : lastUpdateTime); + // Always pass the `since` cursor so the server can short-circuit cheaply + // when nothing has changed; SSE-driven `force` only bypasses the + // client-side update_time equality gate, not the server-side cursor — + // we don't want to refetch items the client already has. + const history = await historyStore.loadCurrentHistory(lastUpdateTime); const { lastCheckedTime } = storeToRefs(historyItemsStore); lastCheckedTime.value = checkForUpdate; if (!history || !history.id) {