({
children,
onIdentify,
initialHint = null,
}: {
children: React.ReactNode;
onIdentify?: IdentifyFn;
/**
* The auth hint as the HOST's server saw it on this request (cloud: from
* the SSR gate via the root loader, dehydrated to the client). When set,
* SSR paints the authenticated shell instead of a loading state.
*/
initialHint?: AuthHint | null;
})
| 138 | }; |
| 139 | |
| 140 | export const AuthProvider = ({ |
| 141 | children, |
| 142 | onIdentify, |
| 143 | initialHint = null, |
| 144 | }: { |
| 145 | children: React.ReactNode; |
| 146 | onIdentify?: IdentifyFn; |
| 147 | /** |
| 148 | * The auth hint as the HOST's server saw it on this request (cloud: from |
| 149 | * the SSR gate via the root loader, dehydrated to the client). When set, |
| 150 | * SSR paints the authenticated shell instead of a loading state. |
| 151 | */ |
| 152 | initialHint?: AuthHint | null; |
| 153 | }) => { |
| 154 | if (typeof window === "undefined") { |
| 155 | return ( |
| 156 | <AuthContext.Provider value={hintState(initialHint) ?? { status: "loading" }}> |
| 157 | {children} |
| 158 | </AuthContext.Provider> |
| 159 | ); |
| 160 | } |
| 161 | return ( |
| 162 | <AuthProviderClient onIdentify={onIdentify} initialHint={initialHint}> |
| 163 | {children} |
| 164 | </AuthProviderClient> |
| 165 | ); |
| 166 | }; |
nothing calls this directly
no test coverage detected