mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-12-08 02:12:34 -05:00
fix-deploy-and-manifest-issue
This commit is contained in:
@@ -12,14 +12,12 @@ const WagmiProvider = dynamic(
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
export function Providers({
|
||||
session,
|
||||
children,
|
||||
shouldUseSession = false,
|
||||
}: {
|
||||
session: any | null;
|
||||
session: unknown | null;
|
||||
children: React.ReactNode;
|
||||
shouldUseSession?: boolean;
|
||||
}) {
|
||||
@@ -34,18 +32,31 @@ export function Providers({
|
||||
return Promise.resolve().then(() => {
|
||||
// Use eval to avoid build-time module resolution
|
||||
try {
|
||||
// @ts-ignore - These modules may not exist in all template variants
|
||||
const nextAuth = eval('require("next-auth/react")');
|
||||
const authKit = eval('require("@farcaster/auth-kit")');
|
||||
|
||||
return ({ children }: { children: React.ReactNode }) => (
|
||||
|
||||
const AuthWrapper = ({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) => (
|
||||
<nextAuth.SessionProvider session={session}>
|
||||
<authKit.AuthKitProvider config={{}}>{children}</authKit.AuthKitProvider>
|
||||
<authKit.AuthKitProvider config={{}}>
|
||||
{children}
|
||||
</authKit.AuthKitProvider>
|
||||
</nextAuth.SessionProvider>
|
||||
);
|
||||
} catch (error) {
|
||||
AuthWrapper.displayName = 'AuthWrapper';
|
||||
return AuthWrapper;
|
||||
} catch (_error) {
|
||||
// Fallback component when auth modules aren't available
|
||||
return ({ children }: { children: React.ReactNode }) => <>{children}</>;
|
||||
const FallbackWrapper = ({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) => <>{children}</>;
|
||||
FallbackWrapper.displayName = 'FallbackWrapper';
|
||||
return FallbackWrapper;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user