fix: replace to invalidate context

This commit is contained in:
Aslam H
2024-10-30 05:40:38 +07:00
parent fcffba23f1
commit 5294ade0ab
7 changed files with 20 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ import { createFileRoute, Outlet, redirect } from "@tanstack/react-router"
export const Route = createFileRoute("/_layout/(auth)/_auth")({
beforeLoad({ context }) {
if (context.auth.userId) {
if (context.auth?.userId) {
throw redirect({ to: "/links", replace: true })
}
},

View File

@@ -89,7 +89,7 @@ export const TopicDetailHeader = React.memo(function TopicDetailHeader({
const handleAddToProfile = (learningState: LearningStateValue) => {
if (me?._type === "Anonymous") {
return clerk.redirectToSignIn({
redirectUrl: pathname,
signInFallbackRedirectUrl: pathname,
})
}

View File

@@ -77,7 +77,7 @@ export const LinkItem = React.memo(
(learningState: LearningStateValue) => {
if (!personalLinks || !me || me?._type === "Anonymous") {
return clerk.redirectToSignIn({
redirectUrl: pathname,
signInFallbackRedirectUrl: pathname,
})
}

View File

@@ -173,7 +173,6 @@ export const LinkForm: React.FC<LinkFormProps> = ({
ref.current?.contains(event.target as Node),
)
) {
console.log("clicking outside")
onClose?.()
}
})