The TanStack Store React quick start page has too many redirects
richardtknight opened this issue · comments
Describe the bug
The link to "quick start" doesn't load anything, and if you open it in a new tab, eventually it resolves into an ERR_TOO_MANY_REDIRECTS error being thrown as per the screenshot attached.
Your Example Website or App
https://tanstack.com/store/latest/docs/framework/react/quick-start
Steps to Reproduce the Bug or Issue
- Go to the TanStack store documentation overview page
- Click "Quick Start" in the left hand menu
- Wait...
Expected behavior
As a user I expected the quick start page to load.
Screenshots or Videos
Platform
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response
#133 will fix this (See this comment).
Basically, the example routes are not set up correctly. When the user loads /store/latest/framework/react/quick-start
it matches the store.$version.docs.framework.$framework.$examples._index.tsx
route, where $examples
is a dynamic segment.
Note
These are the values of the route params: {version: "latest", framework: "react", examples: "quick-start
}`
The problem is that this is the loader of store.$version.docs.framework.$framework.$examples._index.tsx
:
export const loader = (context: LoaderFunctionArgs) => {
throw redirect(context.request.url.replace('/examples/', `/examples/simple`))
}
Since context.request.url
does not contain '/examples/'
, it'll just redirect the route to itself. This is where the infinite redirects come from.
The solution is simply to drop the $
from $examples
in examples' routes:
app/routes/store.$version.docs.framework.$framework.$examples._index.tsx
->app/routes/store.$version.docs.framework.$framework.examples._index.tsx
- app/routes/store.$version.docs.framework.$framework.$examples.$.tsx -> app/routes/store.$version.docs.framework.$framework.examples.$.tsx
I think it's just a typo, because the form routes already look like the fixed version.
Closed, as @fulopkovacs's work is merged! Thank you!!