beforeLoad not loading before the loader #5010
Unanswered
rhuanbarreto
asked this question in
Q&A
Replies: 1 comment
-
can you please provide a complete minimal reproducer by forking one of the existing router stackblitz examples? |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Don't think that's a bug yet, but rather a quirk that may be a bug.
I'm using
beforeLoad
to authenticate/verify the user before loading the page. I added this on a/_layout
route right after the root route so all pages under/_layout
are authenticated.Then I expose the data loaded from loaderData to the page loader so I can use it on the UI by forwarding the context outputs to the loader output so I don't need to load it again.
For understanding,
rootLoader
calls an API to fetch some configurations and executes the authentication chain.Then I use it on the layout component:
The problem is that sometimes the loader data (in this case
publicInfo
) comes asundefined
, which is weird oncebeforeLoad
should run beforeloader
.Am I missing something here?
Beta Was this translation helpful? Give feedback.
All reactions