Description
The admin content list route currently has a hook-order bug in ContentListPage that can trigger React error #300:
Minified React error #300
Rendered fewer hooks than expected
I hit this on the admin Posts page while navigating/clicking quickly in the dashboard.
Root cause
In packages/admin/src/router.tsx, ContentListPage defines React.useMemo(...) after early returns for:
if (!manifest) return <LoadingScreen />
if (!collectionConfig) return <NotFoundPage ... />
if (error) return <ErrorScreen ... />
That means some renders execute fewer hooks than others, which violates React's hook rules.
Relevant source
packages/admin/src/router.tsx
The current shape on main still looks like this:
if (!manifest) {
return <LoadingScreen />;
}
const collectionConfig = manifest.collections[collection];
if (!collectionConfig) {
return <NotFoundPage ... />;
}
if (error) {
return <ErrorScreen ... />;
}
const items = React.useMemo(() => {
return data?.pages.flatMap((page) => page.items) || [];
}, [data]);
Suggested fix
Move the useMemo call above any early returns, or compute items without a hook.
For example:
const items = React.useMemo(() => {
return data?.pages.flatMap((page) => page.items) || [];
}, [data]);
if (!manifest) return <LoadingScreen />;
// ...
Environment
@emdash-cms/admin: 0.1.1
- also visible in upstream
main as of 2026-04-10
Notes
I fixed this locally by moving the hook above the early returns, and the React #300 error stopped occurring on the content list route.
Description
The admin content list route currently has a hook-order bug in
ContentListPagethat can trigger React error#300:I hit this on the admin
Postspage while navigating/clicking quickly in the dashboard.Root cause
In
packages/admin/src/router.tsx,ContentListPagedefinesReact.useMemo(...)after early returns for:if (!manifest) return <LoadingScreen />if (!collectionConfig) return <NotFoundPage ... />if (error) return <ErrorScreen ... />That means some renders execute fewer hooks than others, which violates React's hook rules.
Relevant source
packages/admin/src/router.tsxThe current shape on
mainstill looks like this:Suggested fix
Move the
useMemocall above any early returns, or computeitemswithout a hook.For example:
Environment
@emdash-cms/admin:0.1.1mainas of 2026-04-10Notes
I fixed this locally by moving the hook above the early returns, and the React
#300error stopped occurring on the content list route.