MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / clientOnly

Function clientOnly

apps/start/src/components/theme-provider.tsx:11–14  ·  view source on GitHub ↗
(fn: T)

Source from the content-addressed store, hash-verified

9const AppThemeSchema = z.enum(['light', 'dark']).catch('light');
10
11const clientOnly = <T extends (...args: any[]) => void>(fn: T) => {
12 if (typeof window === 'undefined') return (() => {}) as unknown as T;
13 return fn;
14};
15
16export type UserTheme = z.infer<typeof UserThemeSchema>;
17export type AppTheme = z.infer<typeof AppThemeSchema>;

Callers 1

theme-provider.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected