Cannot read properties of undefined (reading '__loaders') #681
Answered
by
peternedap
peternedap
asked this question in
Questions and Help
-
We're running into an issue where the user's session has expired and they try to change the route. This code seems to not check whether the promise has resolved correctly. This results in the following error: ![]() We'd like a way to check why a routing requests fails using the HTTP status of the reply. |
Beta Was this translation helpful? Give feedback.
Answered by
peternedap
Aug 13, 2025
Replies: 1 comment 5 replies
-
|
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've further reduced the example and found the problem in the process:
We use the
vite:preloadError
hook to detect failures in module loads and redirect to the login page. To prevent unnecessary error logging we then stop the event as well:The
event.preventDefault
here interferes with the router. After removing it theRouter.onError
hook works as expected again.