mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
fix: dont refetch every navigate
This commit is contained in:
@@ -4,14 +4,12 @@ import {
|
||||
Outlet,
|
||||
ScrollRestoration,
|
||||
createRootRouteWithContext,
|
||||
useLocation,
|
||||
} from "@tanstack/react-router"
|
||||
import { Body, Head, Html, Meta, Scripts } from "@tanstack/start"
|
||||
import * as React from "react"
|
||||
import { fetchClerkAuth } from "~/actions"
|
||||
import { DefaultCatchBoundary } from "~/components/DefaultCatchBoundary.js"
|
||||
import { NotFound } from "~/components/NotFound.js"
|
||||
import { isServer } from "~/lib/utils"
|
||||
import appCss from "~/styles/app.css?url"
|
||||
|
||||
export const TanStackRouterDevtools =
|
||||
@@ -66,18 +64,15 @@ export const Route = createRootRouteWithContext<{
|
||||
{ rel: "manifest", href: "/site.webmanifest", color: "#fffff" },
|
||||
{ rel: "icon", href: "/favicon.ico" },
|
||||
],
|
||||
beforeLoad: async ({ context, cause, location }) => {
|
||||
// console.log(cause, location)
|
||||
|
||||
const { user } = await fetchClerkAuth()
|
||||
return {
|
||||
user,
|
||||
beforeLoad: async ({ cause }) => {
|
||||
if (cause !== "stay") {
|
||||
const auth = await fetchClerkAuth()
|
||||
return { auth }
|
||||
}
|
||||
// }
|
||||
|
||||
// return {
|
||||
// user: null,
|
||||
// }
|
||||
return {
|
||||
auth: null,
|
||||
}
|
||||
},
|
||||
errorComponent: (props) => {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user