diff --git a/apps/mana/apps/web/src/lib/data/sync.ts b/apps/mana/apps/web/src/lib/data/sync.ts index 98df318a8..1cf435317 100644 --- a/apps/mana/apps/web/src/lib/data/sync.ts +++ b/apps/mana/apps/web/src/lib/data/sync.ts @@ -551,6 +551,13 @@ export function createUnifiedSync(serverUrl: string, getToken: () => Promise Promise { + try { + const leftoverAppIds = new Set(); + await db.table('_pendingChanges').each((change: { appId?: string }) => { + if (change.appId) leftoverAppIds.add(change.appId); + }); + for (const appId of leftoverAppIds) { + if (channels.has(appId)) schedulePush(appId); + } + } catch { + // DB not ready or query failed — next user write will trigger push anyway. + } + })(); + } + function stopAll(): void { for (const [, channel] of channels) { if (channel.pushTimer) clearTimeout(channel.pushTimer);