Skip to content

Commit

Permalink
fix: Update Tanstack Start (#1714)
Browse files Browse the repository at this point in the history
  • Loading branch information
LekoArts authored Nov 20, 2024
1 parent 57a0b5a commit 94f8b36
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
27 changes: 13 additions & 14 deletions docs/quickstarts/tanstack-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ description: Learn how to use Clerk to quickly and easily add secure authenticat

<CodeBlockTabs options={["npm", "yarn", "pnpm"]}>
```bash {{ filename: 'terminal' }}
npm install @clerk/tanstack-start@beta
npm install @clerk/tanstack-start
```

```bash {{ filename: 'terminal' }}
yarn add @clerk/tanstack-start@beta
yarn add @clerk/tanstack-start
```

```bash {{ filename: 'terminal' }}
pnpm add @clerk/tanstack-start@beta
pnpm add @clerk/tanstack-start
```
</CodeBlockTabs>

Expand Down Expand Up @@ -100,7 +100,7 @@ description: Learn how to use Clerk to quickly and easily add secure authenticat

```tsx {{ filename: 'app/routes/__root.tsx', ins: [4, 18, 29] }}
import { Outlet, ScrollRestoration, createRootRoute } from '@tanstack/react-router'
import { Body, Head, Html, Meta, Scripts } from '@tanstack/start'
import { Meta, Scripts } from '@tanstack/start'
import * as React from 'react'
import { ClerkProvider } from '@clerk/tanstack-start'

Expand All @@ -117,16 +117,16 @@ description: Learn how to use Clerk to quickly and easily add secure authenticat
function RootDocument({ children }: { children: React.ReactNode }) {
return (
<ClerkProvider>
<Html>
<Head>
<html>
<head>
<Meta />
</Head>
<Body>
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</Body>
</Html>
</body>
</html>
</ClerkProvider>
)
}
Expand Down Expand Up @@ -166,12 +166,10 @@ description: Learn how to use Clerk to quickly and easily add secure authenticat
<h1>Index Route</h1>
<SignedIn>
<p>You are signed in</p>

<UserButton />
</SignedIn>
<SignedOut>
<p>You are signed out</p>

<SignInButton />
</SignedOut>
</div>
Expand All @@ -190,9 +188,10 @@ description: Learn how to use Clerk to quickly and easily add secure authenticat
import { createFileRoute, redirect } from '@tanstack/react-router'
import { createServerFn } from '@tanstack/start'
import { getAuth } from '@clerk/tanstack-start/server'
import { getWebRequest } from 'vinxi/http'

const authStateFn = createServerFn('GET', async (_, { request }) => {
const { userId } = await getAuth(request)
const authStateFn = createServerFn({ method: 'GET' }).handler(async () => {
const { userId } = await getAuth(getWebRequest())

if (!userId) {
// This will error because you're redirecting to a path that doesn't exist yet
Expand Down
5 changes: 3 additions & 2 deletions docs/references/tanstack-start/get-auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ The following example demonstrates how to use `getAuth()` to retrieve authentica
import { createFileRoute, useRouter, redirect } from '@tanstack/react-router'
import { createServerFn } from '@tanstack/start'
import { getAuth } from '@clerk/tanstack-start/server'
import { getWebRequest } from 'vinxi/http'

const authStateFn = createServerFn('GET', async (_, { request }) => {
const { userId } = await getAuth(request)
const authStateFn = createServerFn({ method: 'GET' }).handler(async () => {
const { userId } = await getAuth(getWebRequest())

if (!userId) {
// This might error if you're redirecting to a path that doesn't exist yet
Expand Down

0 comments on commit 94f8b36

Please sign in to comment.