Merge pull request #193 from johndoe6345789/codex/define-syncable_stores-and-refactor-conditions

Centralize syncable stores in syncSlice with `SYNCABLE_STORES`
This commit is contained in:
2026-01-18 18:27:53 +00:00
committed by GitHub

View File

@@ -9,6 +9,8 @@ import { db } from '@/lib/db'
export type SyncStatus = 'idle' | 'syncing' | 'success' | 'error'
const SYNCABLE_STORES = new Set(['files', 'models', 'components', 'workflows'])
interface SyncState {
status: SyncStatus
lastSyncedAt: number | null
@@ -77,6 +79,10 @@ export const syncFromFlaskBulk = createAsyncThunk(
}
for (const [key, value] of Object.entries(data)) {
const [storeName, id] = key.split(':')
if (SYNCABLE_STORES.has(storeName)) {
await db.put(storeName as any, value)
if (typeof key !== 'string') {
continue
}