♻️ Coalesce realtime changes and stay quiet offline

Every PocketBase event ran its own full sync of the collection, with
rejections nobody caught and around beforeSync and onSyncRound. A
remote change now starts a round through syncNow(), at most one per
300 ms window; one that lands while a round runs gets its own round
after it. The debounced local push is unchanged.

A failed pull or push no longer sets the sync error while the browser
is offline, since the layout shows "Offline" then. A failed round
reports the distinct errors of its syncs on one line instead of the
heading syncAll() puts above them.
This commit is contained in:
2026-12-01 19:08:57 +01:00
parent d5b21c431e
commit cb9e250f6a
4 changed files with 92 additions and 16 deletions
+1
View File
@@ -29,6 +29,7 @@ const mocks = vi.hoisted(() => {
});
vi.mock('$lib/pb', () => ({
errorMessage: (e: unknown) => (e instanceof Error ? e.message : String(e)),
pb: {
authStore: { isValid: true },
autoCancellation: () => undefined,