An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
fix: address PR review comments
Yoshiki Miura0824a4142fac
diff --git a/app/api/chat/route.ts b/app/api/chat/route.tsindex b98b1bec..66a73034 100644--- a/app/api/chat/route.ts+++ b/app/api/chat/route.ts@@ -84,7 +84,7 @@ export async function POST(req: Request) {message,model: selectedModel,chatId,- userId: userId,+ userId: userId, // userId is guaranteed to be non-null after authentication check abovetrigger,messageId,abortSignaldiff --git a/hooks/use-auth-check.tsx b/hooks/use-auth-check.tsxindex 9a4a538e..0dec583b 100644--- a/hooks/use-auth-check.tsx+++ b/hooks/use-auth-check.tsx@@ -9,9 +9,11 @@ export function useAuthCheck() {const [loading, setLoading] = useState(true)useEffect(() => {+ // Create a single Supabase client instance for this effect+ const supabase = createClient()+const checkAuth = async () => {try {- const supabase = createClient()const {data: { session }} = await supabase.auth.getSession()@@ -26,8 +28,7 @@ export function useAuthCheck() {checkAuth()- // Subscribe to auth changes- const supabase = createClient()+ // Subscribe to auth changes using the same client instanceconst {data: { subscription }} = supabase.auth.onAuthStateChange((event, session) => {