- Notifications
You must be signed in to change notification settings - Fork881
Description
Which project does this relate to?
Start
Describe the bug
https://tanstack.com/start/latest/docs/framework/react/examples/start-basic-auth?path=examples%2Freact%2Fstart-basic-auth%2Fsrc%2Froutes%2F_authed%2Fposts.route.tsx
It seems the example from React Example: Start Basic Auth is broken and you get a error:
Error: Context is not available at Object.use (file:///home/projects/zzmivyjkqa.github/node_modules/unctx/dist/index.mjs:50:15) at getEvent (file:///home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-server-core/dist/esm/h3.js:286:40) at getHTTPEvent (file:///home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-server-core/dist/esm/h3.js:173:10) at eval (file:///home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-server-core/dist/esm/h3.js:189:20) at eval (/home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-server-functions-ssr/dist/esm/index.js:13:104) at serverFnFetcher (/home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-server-functions-fetcher/dist/esm/index.js:41:35) at Object.ssrFn (/home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-server-functions-ssr/dist/esm/index.js:12:53) at client (file:///home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js:345:77) at applyMiddleware (file:///home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js:275:10) at next (file:///home/projects/zzmivyjkqa.github/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js:147:14) { routerCode: 'BEFORE_LOAD'}
I was looking at this example due to my own apps pathless routes breaking with the errorComponent not being loaded after a refresh. Which is setup basically the same as the _authed.tsx example and when adding console.log statements to where the Login form is registered it is getting their but continuing to the page. It seems this is the same case as for going to the example in the docs even tho it says Context is undefined. So there may be two bugs that are occuring here or they may be linked not sure with the example app.
Your Example Website or App
https://tanstack.com/start/latest/docs/framework/react/examples/start-basic-auth?panel=code
Steps to Reproduce the Bug or Issue
- Go to posts. Notice it says context is undefined
- Refresh page via f5 / the refresh button it will now say posts is not iterable showing that it bypassing the _authed pathless route login component. Sometimes you will see the login page for a second and it go to this error.
Expected behavior
It should load the Login component and not go to the posts page
Screenshots or Videos
https://gyazo.com/47138f96b51aa0a0346587e7497390d8
Platform
- OS: Windows
- Browser: chrome
- Version: 134.0.6998.166 (Official Build) (64-bit)
Additional context
No response