Compare commits
1 commit
5b0d27175c
...
f273e4ad8b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f273e4ad8b |
1 changed files with 0 additions and 10 deletions
|
|
@ -4,7 +4,6 @@ import { syncOutbox, lists, tasks, tags, taskTags } from '@/src/db/schema';
|
|||
import { useSettingsStore } from '@/src/stores/useSettingsStore';
|
||||
import { getAccessToken } from '@/src/lib/authToken';
|
||||
import { randomUUID } from '@/src/lib/uuid';
|
||||
import { syncWidgetData } from '@/src/services/widgetSync';
|
||||
|
||||
const SYNC_API_BASE = 'https://liste.lacompagniemaximus.com';
|
||||
const INBOX_ID = '00000000-0000-0000-0000-000000000001';
|
||||
|
|
@ -98,8 +97,6 @@ export async function pushChanges(): Promise<void> {
|
|||
.set({ syncedAt: now })
|
||||
.where(eq(syncOutbox.id, entry.id));
|
||||
}
|
||||
// Refresh widget after a successful push to reflect the synced state
|
||||
syncWidgetData().catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,11 +118,9 @@ export async function pullChanges(since: string): Promise<void> {
|
|||
|
||||
const data: SyncPullResponse = await res.json();
|
||||
|
||||
let appliedChanges = 0;
|
||||
for (const change of data.changes) {
|
||||
try {
|
||||
await applyChange(change);
|
||||
appliedChanges++;
|
||||
} catch (err) {
|
||||
console.warn(`[sync] failed to apply change for ${change.entity_type}/${change.entity_id}:`, err);
|
||||
}
|
||||
|
|
@ -135,11 +130,6 @@ export async function pullChanges(since: string): Promise<void> {
|
|||
if (data.sync_token) {
|
||||
useSettingsStore.getState().setLastSyncAt(data.sync_token);
|
||||
}
|
||||
|
||||
// Refresh widget once after applying all remote changes
|
||||
if (appliedChanges > 0) {
|
||||
syncWidgetData().catch(() => {});
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('[sync] pull error:', err);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue