Interface: SiteSyncActions
Defined in: src/stores/sites/useSiteSync.ts:56
Site synchronization actions interface.
Remarksโ
Defines all available site synchronization operations that can be performed. These actions are designed to work within the Zustand store architecture and provide consistent error handling and logging.
Propertiesโ
fullResyncSites()โ
fullResyncSites: () =>
Promise<void>
Defined in: src/stores/sites/useSiteSync.ts:68
Performs complete resynchronization from the backend with full state replacement.
Returnsโ
Promise<void>
Promise that resolves when synchronization is complete
Remarksโ
Triggers a comprehensive sync operation that replaces all local site data with authoritative information from the backend. This method provides complete data consistency and is used for recovery scenarios.
getSyncStatus()โ
getSyncStatus: () =>
Promise<{lastSyncAt?:number|null;siteCount:number;source:"cache"|"database"|"frontend";synchronized:boolean; }>
Defined in: src/stores/sites/useSiteSync.ts:83
Retrieves current synchronization status from the backend.
Returnsโ
Promise<{ lastSyncAt?: number | null; siteCount: number; source: "cache" | "database" | "frontend"; synchronized: boolean; }>
Promise resolving to sync status information
Remarksโ
Provides detailed information about the sync state including:
- Last synchronization timestamp
- Current site count
- Origin of the synchronized data
- Whether the renderer is in sync with the backend
retryStatusSubscription()โ
retryStatusSubscription: (
callback?: (update:StatusUpdate) =>void) =>Promise<StatusUpdateSubscriptionSummary>
Defined in: src/stores/sites/useSiteSync.ts:86
Retry status update subscription using the most recent callback
Parametersโ
callback?โ
(update: StatusUpdate) => void
Returnsโ
Promise<StatusUpdateSubscriptionSummary>
subscribeToStatusUpdates()โ
subscribeToStatusUpdates: (
callback?: (update:StatusUpdate) =>void) =>Promise<StatusUpdateSubscriptionSummary>
Defined in: src/stores/sites/useSiteSync.ts:105
Establishes subscription to real-time status updates.
Parametersโ
callback?โ
(update: StatusUpdate) => void
Function to call when status updates are received
Returnsโ
Promise<StatusUpdateSubscriptionSummary>
Subscription result with success indicators
Remarksโ
Sets up event listeners for monitor status changes from the backend. Uses the shared StatusUpdateManager to handle:
- Race condition prevention
- Fallback mechanisms
- Efficient incremental updates
subscribeToSyncEvents()โ
subscribeToSyncEvents: () => () =>
void
Defined in: src/stores/sites/useSiteSync.ts:124
Establishes subscription to backend synchronization events.
Returnsโ
Cleanup function to remove event listeners
():
void
Returnsโ
void
Remarksโ
Listens for various sync events including:
- Bulk synchronization events
- Individual site updates
- Site deletions
Automatically handles different event types and triggers appropriate local state updates.
syncSites()โ
syncSites: () =>
Promise<void>
Defined in: src/stores/sites/useSiteSync.ts:138
Synchronizes sites data with backend while preserving local state.
Returnsโ
Promise<void>
Promise that resolves when sync is complete
Remarksโ
Fetches the latest site data from the backend and updates the local store state. Includes comprehensive error handling and logging for debugging purposes.
This is the core synchronization method used by other sync operations.
unsubscribeFromStatusUpdates()โ
unsubscribeFromStatusUpdates: () =>
StatusUpdateUnsubscribeResult
Defined in: src/stores/sites/useSiteSync.ts:150
Removes subscription to status updates.
Returnsโ
Unsubscription result with success indicators
Remarksโ
Cleanly unsubscribes from status update events and releases associated resources. Should be called when components unmount or when status updates are no longer needed.