Typed route support for admin homepage? #14964
JinxedStar
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been experimenting with next v16 and is fooling around with new configs (it's been a while since we updated our nextjs config but we're currently on v15) and noticed one small thing causing build issues: typed routes.
The entire admin panel works perfectly, but when we create a link to the "admin homepage" elsewhere in our app via
<Link href="/admin">the compiler complains that the route doesn't exist! Upon investigation it makes sense because the default payload template uses/src/app/(payload)/admin/[[...segments]]/page.tsxwhich will work properly but the nextjs compiler doesn't recognize it as a real route to/adminargh!Any suggestions or ideas on how to solve this? I don't want to hack around this by creating custom routes or adding
// @ts-expect-errorto all places in the codebase which links to the admin route :(Our current workaround is to link to
/admin/loginwhich works A-OK but it feels like an extra indirection step when the user is already logged in and causes extra latency for the client as it would have to make several round-trips to the server to navigate to the admin homepage - and possibly cause react re-renders as it thinks we're navigating elsewhere!Beta Was this translation helpful? Give feedback.
All reactions