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

fix: Update Tanstack Start #1714

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +42 to +50
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't actively publish the package under the @beta tag so the current beta tagged version is outdated compared to latest. We don't use that tag for other packages that are still Beta (e.g. Elements) so this changes it so that people installed the latest version

```
</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
Loading