TanStack / tanstack.com

The marketing and docs site for all TanStack projects

Home Page:https://tanstack.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Go to the TanStack store documentation overview page
  2. Click "Quick Start" in the left hand menu
  3. Wait...

Expected behavior

As a user I expected the quick start page to load.

Screenshots or Videos

Screenshot 2023-12-23 at 16 20 25

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

No response

commented

#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!!