mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 13:44:54 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user