fix: dont refetch every navigate

This commit is contained in:
Aslam H
2024-10-07 17:59:37 +07:00
parent b43c9762a1
commit e14714d5dd
4 changed files with 10 additions and 17 deletions

View File

@@ -2,7 +2,8 @@ import { createFileRoute, Outlet, redirect } from "@tanstack/react-router"
export const Route = createFileRoute("/_layout/_pages/_protected")({
beforeLoad: ({ context, location, cause }) => {
if (!context?.user?.userId) {
if (cause === "stay") return
if (!context?.auth?.userId) {
throw redirect({
to: "/sign-in/$",
search: { redirect_url: location.pathname },

View File

@@ -290,7 +290,6 @@ const DetailPageForm = ({ page }: { page: PersonalPage }) => {
onUpdate={(c) => updatePageContent(c, page)}
handleKeyDown={handleContentKeyDown}
onBlur={(c) => updatePageContent(c, page)}
onNewBlock={(c) => updatePageContent(c, page)}
/>
</div>
</div>