fix(layout): passar sidebarOpen para Header (corrige UI completa quebrada)#91
fix(layout): passar sidebarOpen para Header (corrige UI completa quebrada)#91adm01-debug wants to merge 2 commits into
Conversation
…MainLayout)
Header.tsx referenced `sidebarOpen` on lines 151-152 (aria-label and
aria-expanded for the hamburger button) but the variable was neither
declared in props nor in the component's scope — it only existed in
MainLayout.tsx. Every render of <Header /> threw ReferenceError:
sidebarOpen is not defined, which bubbled up to the global
EnhancedErrorBoundary in ProtectedRoute and showed "Falha no Módulo".
Sometimes the inner Suspense of <Header> caught it and just hid the
header silently (sidebar/header both missing because the same condition
caused a different render-time failure). Other sessions hit the outer
boundary and showed the full module-failure UI.
Telemetry confirms 82 occurrences of this exact ReferenceError in the
last ~5 hours on '/' and '/orcamentos/novo'.
Fix:
• Add `sidebarOpen: boolean` to HeaderProps and destructure it
• Pass it from MainLayout (where the state lives) into <Header />
• Drop the unused searchQuery/onSearchChange props that no longer
flowed anywhere (search state is owned by useSearchStore)
• Clean up the unused imports the lint-staged hook caught while we
were touching these files (Settings, RotateCcw, getRoleLabel,
BackButton, isMockupGenerator, hasCompletedTour, etc.)
https://claude.ai/code/session_01CUVPfuj5W2dNtPNPAL7iA7
…-explicit-any) Two test files that the Lovable bot recently touched introduced new ESLint baseline regressions which started blocking the pre-push hook on unrelated branches: - src/contexts/AuthContext.test.tsx: `import()` type annotation forbidden by @typescript-eslint/consistent-type-imports. Hoisted the type-only import to the top of the file and reused via typeof. - src/tests/AdminLayout.test.tsx: explicit `any` on a mock callback. Tightened to the actual callback shape vi.fn() expects. These are surgical lint-only fixes in tests; no runtime behaviour changes. https://claude.ai/code/session_01CUVPfuj5W2dNtPNPAL7iA7
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
* fix(layout): pass sidebarOpen prop to Header (ReferenceError crashed MainLayout)
Header.tsx referenced `sidebarOpen` on lines 151-152 (aria-label and
aria-expanded for the hamburger button) but the variable was neither
declared in props nor in the component's scope — it only existed in
MainLayout.tsx. Every render of <Header /> threw ReferenceError:
sidebarOpen is not defined, which bubbled up to the global
EnhancedErrorBoundary in ProtectedRoute and showed "Falha no Módulo".
Sometimes the inner Suspense of <Header> caught it and just hid the
header silently (sidebar/header both missing because the same condition
caused a different render-time failure). Other sessions hit the outer
boundary and showed the full module-failure UI.
Telemetry confirms 82 occurrences of this exact ReferenceError in the
last ~5 hours on '/' and '/orcamentos/novo'.
Fix:
• Add `sidebarOpen: boolean` to HeaderProps and destructure it
• Pass it from MainLayout (where the state lives) into <Header />
• Drop the unused searchQuery/onSearchChange props that no longer
flowed anywhere (search state is owned by useSearchStore)
• Clean up the unused imports the lint-staged hook caught while we
were touching these files (Settings, RotateCcw, getRoleLabel,
BackButton, isMockupGenerator, hasCompletedTour, etc.)
https://claude.ai/code/session_01CUVPfuj5W2dNtPNPAL7iA7
* chore(tests): satisfy lint baseline gate (consistent-type-imports, no-explicit-any)
Two test files that the Lovable bot recently touched introduced new
ESLint baseline regressions which started blocking the pre-push hook
on unrelated branches:
- src/contexts/AuthContext.test.tsx: `import()` type annotation
forbidden by @typescript-eslint/consistent-type-imports. Hoisted the
type-only import to the top of the file and reused via typeof.
- src/tests/AdminLayout.test.tsx: explicit `any` on a mock callback.
Tightened to the actual callback shape vi.fn() expects.
These are surgical lint-only fixes in tests; no runtime behaviour
changes.
https://claude.ai/code/session_01CUVPfuj5W2dNtPNPAL7iA7
---------
Co-authored-by: Claude <noreply@anthropic.com>
🎯 ESTE É O FIX DEFINITIVO da sidebar/header sumida e "Falha no Módulo"
Diagnóstico
Consulta direto na tabela
frontend_telemetrymostrou 82 ocorrências do mesmo ReferenceError em ~5h:Localizado em
src/components/layout/Header.tsxlinhas 151-152:A variável
sidebarOpensó existe no escopo doMainLayout.tsx. Não está nas props doHeadernem em qualquer outro lugar acessível.Cascata do bug
<Header />lançaReferenceError: sidebarOpen is not definedna render<Suspense>que envolve o Header captura e fica preso no fallback (div invisível) → sidebar e header somem silenciosamenteEnhancedErrorBoundaryglobal emProtectedRoute.tsx→ tela "Falha no Módulo" full-screenPor isso o sintoma "variava" entre apenas sumir e quebrar tudo — dependia de qual Suspense capturava primeiro.
Fix
sidebarOpen: booleanna interfaceHeaderPropsonMenuToggleMainLayout(que tem ouseState) pro<Header />searchQuery/onSearchChangenão fluíam pra lugar nenhum — search é viauseSearchStore)Teste manual
https://promogifts.com.brem janela anônimaSequência de PRs hoje
*.vercel.apphttps://claude.ai/code/session_01CUVPfuj5W2dNtPNPAL7iA7
Generated by Claude Code
Summary by cubic
Passes the
sidebarOpenstate fromMainLayouttoHeaderto stop a render-time ReferenceError and restore the header/sidebar across the app. Prevents the intermittent “Falha no Módulo” screen and missing layout.Bug Fixes
sidebarOpen: booleantoHeaderPropsand used it for the hamburger buttonaria-labelandaria-expanded.sidebarOpenfromMainLayoutinto<Header />.searchQuery/onSearchChangeprops (search is viauseSearchStore).sidebarOpen is not definedcrash that hid the header/sidebar or triggered the global error screen.Refactors
AuthContext.test.tsxand stricter mock callback type inAdminLayout.test.tsx(no runtime changes).Written for commit fe0d196. Summary will update on new commits. Review in cubic