Always pass update_time cursor on SSE-driven history refresh

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.
This commit is contained in:
mvdbeek
2026-04-28 19:15:24 +02:00
parent bbb4cdc5f1
commit 5d89d81ca2
+5 -2
View File
@@ -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) {