From 01c58bec663fa209bc062ec595950c1775cdef6b Mon Sep 17 00:00:00 2001 From: BrickheadJohnny Date: Mon, 28 Oct 2024 15:45:08 +0100 Subject: [PATCH] fix(TermsOfUseUpdateDialog): don't open on the `/terms-of-use` page --- src/v2/components/TermsOfUseUpdateDialog.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/v2/components/TermsOfUseUpdateDialog.tsx b/src/v2/components/TermsOfUseUpdateDialog.tsx index 2f9413b71c..f171269c1b 100644 --- a/src/v2/components/TermsOfUseUpdateDialog.tsx +++ b/src/v2/components/TermsOfUseUpdateDialog.tsx @@ -3,6 +3,7 @@ import { useDisclosure } from "@/hooks/useDisclosure" import useUser from "components/[guild]/hooks/useUser" import { SignedValidation, useSubmitWithSign } from "hooks/useSubmit" +import { usePathname } from "next/navigation" import { useEffect } from "react" import fetcher from "utils/fetcher" import { Anchor } from "./ui/Anchor" @@ -20,10 +21,12 @@ const TermsOfUseUpdateDialog = () => { const { id, tosAccepted, mutate } = useUser() const { isOpen, onOpen, onClose } = useDisclosure() + const pathname = usePathname() + useEffect(() => { - if (!id) return + if (!id || pathname?.includes("terms-of-use")) return if (!tosAccepted && !isOpen) onOpen() - }, [id, tosAccepted, isOpen, onOpen]) + }, [id, pathname, tosAccepted, isOpen, onOpen]) const { onSubmit, isLoading } = useSubmitWithSign( (signedValidation: SignedValidation) =>