fix: import Routes and Route in AdminDashboard (admin panel renders blank) - #84
Open
jsnapoli1 wants to merge 1 commit into
Open
fix: import Routes and Route in AdminDashboard (admin panel renders blank)#84jsnapoli1 wants to merge 1 commit into
jsnapoli1 wants to merge 1 commit into
Conversation
AdminDashboard renders <Routes> and <Route> but only imported Navigate
from react-router-dom, so the admin panel crashed on mount with
"Uncaught ReferenceError: Routes is not defined" and rendered a white
screen. The storefront was unaffected because App.jsx imports both.
The build does not catch this: Rollup leaves the unresolved identifiers
as bare globals, so the bundle is emitted successfully. It is visible in
the output as an asymmetry, where every real component is minified but
Routes and Route are not:
p.jsx(Routes,{children:p.jsxs(Route,{element:p.jsx(Jle,{...
eslint also exits clean on the file, since no-undef is not enabled for
JSX component references in the current config.
Claude-Session: https://claude.ai/code/session_015XLFFfHWNeazSuz6UcsQ4C
This was referenced Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The admin panel at
/adminrenders a white screen. The console shows:src/pages/admin/AdminDashboard.jsxrenders<Routes>and<Route>but imports onlyNavigatefromreact-router-dom. WhenAdminDashboardmounts,Routesis undefined, React throws, and the tree unmounts — leaving an empty#root.The storefront is unaffected, because
App.jsximports both correctly. Only the admin route crashes.Why the build doesn't catch it
Rollup leaves the unresolved identifiers as bare globals rather than failing, so the bundle is emitted successfully. It's visible in the output as an asymmetry — every real component is minified, but
RoutesandRouteare not:npx eslint src/pages/admin/AdminDashboard.jsxalso exits clean, sinceno-undefisn't flagging JSX component references under the current config.Fix
Verification
Built and deployed to a live Cloudflare Workers instance.
Before —
#rootempty after the crash.After —
#rootcontains the rendered admin login (verified via headless Chrome--dump-dom):The bundle's former crash site now reads
p.jsx(GI,{...p.jsxs(Dr,— properly resolved and minified. Zero bareRoutes/Routereferences remain.Possible follow-up
Enabling
react/jsx-no-undef(orno-undeffor JSX identifiers) in the eslint config would catch this class of bug at lint time. Happy to open a separate PR if that's wanted.https://claude.ai/code/session_015XLFFfHWNeazSuz6UcsQ4C