Browse Source

fix: increment page view count for seen users on same-route navigation

Shun Miyazawa 3 months ago
parent
commit
ec53f158ca
1 changed files with 5 additions and 0 deletions
  1. 5 0
      apps/app/src/pages/[[...path]]/page-data-props.ts

+ 5 - 0
apps/app/src/pages/[[...path]]/page-data-props.ts

@@ -286,6 +286,11 @@ export async function getPageDataForSameRoute(
     isPermalink ? { _id: pageId } : { path: resolvedPagePath },
     isPermalink ? { _id: pageId } : { path: resolvedPagePath },
   ).exec();
   ).exec();
 
 
+  // Add user to seen users
+  if (user != null) {
+    await basicPageInfo?.seen(user);
+  }
+
   const currentPathname = resolveFinalizedPathname(
   const currentPathname = resolveFinalizedPathname(
     resolvedPagePath,
     resolvedPagePath,
     basicPageInfo,
     basicPageInfo,