nexus / src /lib /app-data /server-only.ts
betterwithage's picture
deploy(hf): sync szl-holdings/nexus@00edebc993282efd5b43b0144b3d3d27ab43e264 derived COPY set
31b3c47 verified
Raw History Blame Contribute Delete
476 Bytes
export function assertAppDataServerOnly(
context = "app-data/client.server",
): void {
if (typeof window !== "undefined") {
throw new Error(
`@/lib/${context} is server-only. Call connector tools from a createServerFn handler (dynamic import of @/lib/app-data/client.server), never from a React component, useEffect, or browser fetch. Types and login helpers are client-safe via @/lib/app-data.`,
);
}
}
assertAppDataServerOnly("app-data/client.server");