diff --git a/src/app/editor/[projectId]/FlowchartEditor.tsx b/src/app/editor/[projectId]/FlowchartEditor.tsx index 2e20982..8f7cc67 100644 --- a/src/app/editor/[projectId]/FlowchartEditor.tsx +++ b/src/app/editor/[projectId]/FlowchartEditor.tsx @@ -46,8 +46,8 @@ import type { FlowchartData, FlowchartNode, FlowchartEdge, Character, Variable, // LocalStorage key prefix for draft saves const DRAFT_KEY_PREFIX = 'vnwrite-draft-' -// Debounce delay in ms -const AUTOSAVE_DEBOUNCE_MS = 1000 +// Debounce delay for LocalStorage draft saves +const AUTOSAVE_DEBOUNCE_MS = 5000 type ContextMenuState = { x: number diff --git a/src/lib/collaboration/crdt.ts b/src/lib/collaboration/crdt.ts index 7c7fcdb..eedf8d8 100644 --- a/src/lib/collaboration/crdt.ts +++ b/src/lib/collaboration/crdt.ts @@ -2,7 +2,7 @@ import * as Y from 'yjs' import type { RealtimeChannel } from '@supabase/supabase-js' import type { FlowchartNode, FlowchartEdge } from '@/types/flowchart' -const PERSIST_DEBOUNCE_MS = 2000 +const PERSIST_DEBOUNCE_MS = 30_000 // 30s - DB persist is for crash recovery only; CRDT handles real-time sync const BROADCAST_EVENT = 'yjs-update' export type CRDTCallbacks = {