Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tanstack React Example: Start Basic Auth Broken #3850

Open
nick22985 opened this issue Mar 25, 2025 · 1 comment
Open

Tanstack React Example: Start Basic Auth Broken #3850

nick22985 opened this issue Mar 25, 2025 · 1 comment

Comments

@nick22985
Copy link

nick22985 commented Mar 25, 2025

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

  1. Go to posts. Notice it says context is undefined
  2. 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

@nick22985
Copy link
Author

#3462 Partial duplicate of this with the second part however the example not working doesnt have to do with that pretty sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant