Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
activate/disable AI button delay issue
Aashish-Upadhyay-101078bf7e6ec45
diff --git a/pages/documents/[id]/index.tsx b/pages/documents/[id]/index.tsxindex 722d3761..bb23ab6a 100644--- a/pages/documents/[id]/index.tsx+++ b/pages/documents/[id]/index.tsx@@ -29,6 +29,7 @@ import NotionIcon from "@/components/shared/icons/notion";import PapermarkSparkle from "@/components/shared/icons/papermark-sparkle";import { Document } from "@prisma/client";import { usePlausible } from "next-plausible";+import { mutate } from "swr";export default function DocumentPage() {const { document: prismaDocument, primaryVersion, error } = useDocument();@@ -179,6 +180,12 @@ export default function DocumentPage() {}).then(() => {// Once the assistant is activated, redirect to the chatplausible("assistantEnabled", { props: { documentId: document.id } }); // track the event++ // refetch to fix the UI delay+ mutate(+ `/api/teams/${teamInfo?.currentTeam?.id}/documents/${document.id}`,+ );+router.push(`/documents/${document.id}/chat`);}),{@@ -267,6 +274,11 @@ export default function DocumentPage() {body: JSON.stringify({documentId: prismaDocument.id,}),+ }).then(() => {+ // refetch to fix the UI delay+ mutate(+ `/api/teams/${teamInfo?.currentTeam?.id}/documents/${prismaDocument.id}`,+ );});toast.promise(fetchPromise, {@@ -290,6 +302,11 @@ export default function DocumentPage() {body: JSON.stringify({documentId: prismaDocument.id,}),+ }).then(() => {+ // refetch to fix the UI delay+ mutate(+ `/api/teams/${teamInfo?.currentTeam?.id}/documents/${prismaDocument.id}`,+ );});toast.promise(fetchPromise, {