import { VibeControlsInitialDataQuery } from '../generated/wspace-operations';
/**
* Options for useInitialDataLoader
*/
interface UseInitialDataLoaderOptions {
/** Workspace ID to use when the hook is called outside provider context */
workspaceId?: string | null;
/** Fetch policy for the initial query */
fetchPolicy?: 'cache-first' | 'network-only' | 'cache-only';
}
/**
* Return type for useInitialDataLoader
*/
interface UseInitialDataLoaderResult {
/** Whether the initial data is still loading */
loading: boolean;
/** Any error that occurred during the initial fetch */
error?: Error;
/** Refetch function to manually refresh all initial data */
refetch: () => void;
/** The loaded data (raw from Apollo cache) */
data?: VibeControlsInitialDataQuery;
}
/**
* Hook that prefetches all initial data for the VibeControls microfrontend.
*
* Usage:
* ```tsx
* function MyComponent() {
* const { loading, error, refetch } = useInitialDataLoader();
*
* if (loading) return