Skip to content

Commit

Permalink
fix serialization error caused by getting full clerk user object (#2976)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-delia authored Dec 11, 2024
1 parent fe8d7cb commit 87a5c12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions examples/react/start-clerk-basic/app/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import { NotFound } from '~/components/NotFound.js'
import appCss from '~/styles/app.css?url'

const fetchClerkAuth = createServerFn({ method: 'GET' }).handler(async () => {
const user = await getAuth(getWebRequest())
const { userId } = await getAuth(getWebRequest())

return {
user,
userId,
}
})

Expand Down Expand Up @@ -64,10 +64,10 @@ export const Route = createRootRoute({
],
}),
beforeLoad: async () => {
const { user } = await fetchClerkAuth()
const { userId } = await fetchClerkAuth()

return {
user,
userId,
}
},
errorComponent: (props) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/react/start-clerk-basic/app/routes/_authed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SignIn } from '@clerk/tanstack-start'

export const Route = createFileRoute('/_authed')({
beforeLoad: ({ context }) => {
if (!context.user.userId) {
if (!context.userId) {
throw new Error('Not authenticated')
}
},
Expand Down

0 comments on commit 87a5c12

Please sign in to comment.