Describe the bug
There's still an issue here when with context when it gets merged with beforeLoad.
export const Route = createFileRoute('/about')({
beforeLoad: async () => {
await new Promise((resolve) => setTimeout(resolve, 5000));
return { someData: 'hello' };
},
loader: async ({context}) => {
await new Promise((resolve) => setTimeout(resolve, 2000));
console.log(context.someData)
},
})
Supposing /about is the lazy route that takes a long time to resolve, if beforeLoad isn't finished before the navigation event happens, the loader gets invoked with an undefined context, breaking the route.
This possibly happens because execution flow is skipped when a route already in beforeLoad fetching state is re-loaded (because the loader gets invoked regardless of the beforeLoad state, for which we have no pending information on reload)
Your Example Website or App
https://stackblitz.com/edit/github-nkiyw7
Steps to Reproduce the Bug or Issue
- Hover
About link
- Immediately click to navigate before the 5000ms beforeLoad is done executing
- Undefined context in loader 🤯
Expected behavior
As a user, I expect context to not be undefined
Screenshots or Videos
No response
Platform
- OS: MacOS
- Browser: Chrome
- Version: 1.43.6
Additional context
No response
Describe the bug
There's still an issue here when with context when it gets merged with beforeLoad.
Supposing
/aboutis the lazy route that takes a long time to resolve, if beforeLoad isn't finished before the navigation event happens, the loader gets invoked with anundefinedcontext, breaking the route.This possibly happens because execution flow is skipped when a route already in
beforeLoadfetching state is re-loaded (because the loader gets invoked regardless of the beforeLoad state, for which we have no pending information on reload)Your Example Website or App
https://stackblitz.com/edit/github-nkiyw7
Steps to Reproduce the Bug or Issue
AboutlinkExpected behavior
As a user, I expect context to not be undefined
Screenshots or Videos
No response
Platform
Additional context
No response