Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

chore: add logging

Marc Seitzb7ac730f272c
diff --git a/components/PagesViewer.tsx b/components/PagesViewer.tsx
index 2e321768..d4f9ff6e 100644
--- a/components/PagesViewer.tsx
+++ b/components/PagesViewer.tsx
@@ -17,6 +17,8 @@ export default function PagesViewer({pages, linkId, documentId, viewId}: {pages:
}, [pageNumber]);
useEffect(() => {
+ console.log("Page number changed to", pageNumber)
+ console.log("isinitialpageload", isInitialPageLoad.current);
startTimeRef.current = Date.now(); // update the start time for the new page
// when component unmounts, calculate duration and track page view
@@ -55,9 +57,12 @@ export default function PagesViewer({pages, linkId, documentId, viewId}: {pages:
async function trackPageView(duration: number = 0) {
// If this is the initial page load, don't send the request
if (isInitialPageLoad.current) {
+ console.log("Initial page load detected, not tracking.");
isInitialPageLoad.current = false;
return;
}
+
+ console.log("Tracking page view.");
await fetch("/api/record_view", {
method: "POST",
diff --git a/components/view/document-view.tsx b/components/view/document-view.tsx
index 1be215c2..23b7af87 100644
--- a/components/view/document-view.tsx
+++ b/components/view/document-view.tsx
@@ -40,7 +40,6 @@ export default function DocumentView({
const handleSubmission = async (): Promise<void> => {
- console.log("handle submission to get views");
setIsLoading(true);
const response = await fetch("/api/views", {
method: "POST",
@@ -73,16 +72,13 @@ export default function DocumentView({
event: React.FormEvent
): Promise<void> => {
event.preventDefault();
- console.log("handle submit");
await handleSubmission();
};
-
- console.log("Render with", { submitted, isProtected });
+
// If link is not submitted and does not have email / password protection, show the access form
useEffect(() => {
if (!didMount.current) {
if (!submitted && !isProtected) {
- console.log("submitting directly");
handleSubmission();
}
didMount.current = true;