UNPKG

@adventurelabs/scout-core

Version:

Core utilities and helpers for Adventure Labs Scout applications

34 lines (33 loc) 1.21 kB
export interface UseScoutRefreshOptions { autoRefresh?: boolean; onRefreshComplete?: () => void; cacheFirst?: boolean; cacheTtlMs?: number; } /** * Hook for refreshing scout data with detailed timing measurements and cache-first loading * * @param options - Configuration options for the refresh behavior * @param options.autoRefresh - Whether to automatically refresh on mount (default: true) * @param options.onRefreshComplete - Callback function called when refresh completes * @param options.cacheFirst - Whether to load from cache first, then refresh (default: true) * @param options.cacheTtlMs - Cache time-to-live in milliseconds (default: 24 hours) * * @returns Object containing: * - handleRefresh: Function to manually trigger a refresh * - clearCache: Function to clear the cache * * @example * ```tsx * const { handleRefresh, clearCache } = useScoutRefresh({ * cacheFirst: true, * cacheTtlMs: 10 * 60 * 1000 // 10 minutes * }); * * // Timing stats are available in Redux store via selectors * ``` */ export declare function useScoutRefresh(options?: UseScoutRefreshOptions): { handleRefresh: () => Promise<void>; clearCache: () => Promise<void>; };