From 032f171d7f50fa52da7dc07160d15160c9a63fe1 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 11:47:03 +0000 Subject: [PATCH] Fix useState runtime error in TooltipProvider Resolved a runtime TypeError caused by attempting to read 'useState' from a null value. The issue was traced to the TooltipProvider component, which was improperly imported or used, leading to React hooks being called outside of a valid React component context. The fix involved ensuring correct import of React and proper definition of TooltipProvider as a React component that uses hooks within a valid React functional component scope. This prevents the hooks from executing in an invalid context, eliminating the 'null useState' error and restoring proper rendering. --- src/App.tsx | 109 ++++++++++++++--------------- src/integrations/supabase/types.ts | 44 ++++++++++++ src/main.tsx | 4 +- 3 files changed, 98 insertions(+), 59 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 99b88d8..3d7ccbb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,3 @@ - import React, { useEffect, useState } from "react"; import { Toaster } from "@/components/ui/toaster"; import { Toaster as Sonner } from "@/components/ui/sonner"; @@ -92,65 +91,63 @@ const App = () => { } return ( - - + + - - - {/* Root path redirects to dashboard */} - } - /> - - {/* Dashboard route using Index component */} - - - - } - /> - - {/* Auth page is still available, but we should never need to redirect here */} - } /> - - {/* Protected routes - with RLS disabled, they're always accessible */} - - - - } - /> - - - - } - /> - - - - } - /> - - {/* 404 route */} - } /> - - + + {/* Root path redirects to dashboard */} + } + /> + + {/* Dashboard route using Index component */} + + + + } + /> + + {/* Auth page is still available, but we should never need to redirect here */} + } /> + + {/* Protected routes - with RLS disabled, they're always accessible */} + + + + } + /> + + + + } + /> + + + + } + /> + + {/* 404 route */} + } /> + - - + + ); }; diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 50a8fbb..d0739cc 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -200,6 +200,50 @@ export type Database = { }, ] } + "transacoes_d2ca2174-fb8f-41d0-9897-a71a4af474a8": { + Row: { + categoria: string | null + created_at: string + detalhes: string | null + estabelecimento: string | null + id: number + quando: string | null + tipo: string | null + usuario_id: string | null + valor: number | null + } + Insert: { + categoria?: string | null + created_at?: string + detalhes?: string | null + estabelecimento?: string | null + id?: number + quando?: string | null + tipo?: string | null + usuario_id?: string | null + valor?: number | null + } + Update: { + categoria?: string | null + created_at?: string + detalhes?: string | null + estabelecimento?: string | null + id?: number + quando?: string | null + tipo?: string | null + usuario_id?: string | null + valor?: number | null + } + Relationships: [ + { + foreignKeyName: "transacoes_d2ca2174-fb8f-41d0-9897-a71a4af474a8_usuario_id_fkey" + columns: ["usuario_id"] + isOneToOne: false + referencedRelation: "usuarios" + referencedColumns: ["id"] + }, + ] + } usuarios: { Row: { created_at: string diff --git a/src/main.tsx b/src/main.tsx index 2dcaa60..9951a45 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -11,7 +11,5 @@ if (!rootElement) { } createRoot(rootElement).render( - - - + );