MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / AuthProvider

Function AuthProvider

packages/react/src/multiplayer/auth-context.tsx:140–166  ·  view source on GitHub ↗
({
  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;
})

Source from the content-addressed store, hash-verified

138};
139
140export 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};

Callers

nothing calls this directly

Calls 1

hintStateFunction · 0.85

Tested by

no test coverage detected