Struggling to Re-Generate Routes with Inertia #823
Unanswered
knightspore
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The simplest fix I could find was to extend the |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
A very simple issue.
From our
login
page, we are redirected toadmin.dashboard
on successful login.We have a set of route groups defined in
config/ziggy.php
:And we show these based on the auth status:
The issue is - when we are first logged in, the
<script />
block containing Ziggy routes is not re-generated. We get a browser error:Uncaught Error: Ziggy error: route 'admin.dashboard' is not in the route list.
At this point, if we hard refresh the
<script />
block is successfully generated again and we now have access to all "auth
" routes.As far as I understand, this would be due to Inertia's internal handling of Navigation (ie. keeping the application shell in place when necessary).
So my question is, how can we force the
@routes
directive to. re-generate the routes block when we successfully login, as well as when we log out - since all the "auth
" routes are now present in the<script/>
block on the login page after we click "Log Out".Beta Was this translation helpful? Give feedback.
All reactions