Skip to content

Conversation

@NarayanBavisetti
Copy link
Collaborator

@NarayanBavisetti NarayanBavisetti commented Aug 26, 2025

Description

this pull request resolves the issue from removing the page from the recent visit on hovering on the page.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • New Features

    • Page visits are now tracked when opening a project page, improving accuracy of recently viewed items and usage insights.
    • Tracking is opt-in per request, providing better control over when visits are recorded.
  • Chores

    • Updated internal client calls to include a visit-tracking flag where applicable.
    • Aligned service and state layers to support the new tracking parameter without changing existing user flows.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds an optional track_visit flag to page retrieval. Frontend propagates a trackVisit boolean through store and service to include track_visit in the GET query. Backend reads the query param and conditionally enqueues recent_visited_task only when true. No other logic or API endpoints changed.

Changes

Cohort / File(s) Summary of Changes
API: Conditional visit tracking
apps/api/plane/app/views/page/base.py
Read track_visit from query params (default false). Invoke recent_visited_task.delay(...) only when true. Retrieve logic otherwise unchanged.
Web service: Parameterized fetch
apps/web/core/services/page/project-page.service.ts
fetchById signature updated to include trackVisit: boolean. Adds params: { track_visit: trackVisit } to GET request. Response/error handling unchanged.
Web store: Propagate trackVisit
apps/web/core/store/pages/project-page.store.ts
fetchPageDetails signature now accepts { trackVisit: boolean }. Passes flag to service fetchById(..., trackVisit). No other flow changes.
Web UI: Enable visit tracking on page view
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx
SWR fetcher calls fetchPageDetails(..., { trackVisit: true }). SWR key and conditions unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as PageDetailsPage (SWR)
  participant S as ProjectPageStore
  participant SV as ProjectPageService
  participant API as API /page retrieve
  participant Q as Task Queue
  participant DB as DB

  U->>S: fetchPageDetails(ws, project, page, { trackVisit: true })
  S->>SV: fetchById(ws, project, page, true)
  SV->>API: GET /.../pages/{id}?track_visit=true
  API->>DB: Fetch page by id
  DB-->>API: Page data
  alt track_visit = true
    API-->>Q: recent_visited_task.delay(page, user)
  else track_visit = false
    Note over API: Skip enqueue
  end
  API-->>SV: 200 OK (page)
  SV-->>S: Page
  S-->>U: Page
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

I hop through pages, quiet and fleet,
A tiny flag beneath my feet.
Track my visit? Check, I squeak—
Flip it on for metrics sleek.
Tasks queue up, carrots cheer,
Toggle true and data’s here.
Thump-thump—another tidy peer! 🥕

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore-track-page-visit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link

makeplane bot commented Aug 26, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@NarayanBavisetti NarayanBavisetti marked this pull request as ready for review August 28, 2025 10:51
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/api/plane/app/views/page/base.py (1)

201-201: Parse boolean query param more robustly

Accept common truthy values and avoid relying on exact "true".

-        track_visit = request.query_params.get("track_visit", "false").lower() == "true"
+        tv = request.query_params.get("track_visit")
+        track_visit = str(tv).lower() in {"1", "true", "t", "yes", "y", "on"}
apps/web/core/store/pages/project-page.store.ts (2)

247-253: Default trackVisit to false at the store boundary

Keeps semantics clear and call sites minimal; pairs with service change.

-  fetchPageDetails = async (
-    workspaceSlug: string,
-    projectId: string,
-    pageId: string,
-    { trackVisit }: { trackVisit: boolean }
-  ) => {
+  fetchPageDetails = async (
+    workspaceSlug: string,
+    projectId: string,
+    pageId: string,
+    { trackVisit = false }: { trackVisit?: boolean } = {}
+  ) => {
@@
-      const page = await this.service.fetchById(workspaceSlug, projectId, pageId, trackVisit);
+      const page = await this.service.fetchById(workspaceSlug, projectId, pageId, trackVisit);

Also applies to: 262-262


52-57: Make options parameter optional on fetchPageDetails
Loosen the signature to avoid breaking callers and clearly document intent:

- fetchPageDetails: (
-   workspaceSlug: string,
-   projectId: string,
-   pageId: string,
-   { trackVisit }: { trackVisit: boolean }
- ) => Promise<TPage | undefined>;
+ fetchPageDetails: (
+   workspaceSlug: string,
+   projectId: string,
+   pageId: string,
+   options?: { trackVisit?: boolean }
+ ) => Promise<TPage | undefined>;

No legacy 3-arg calls to fetchPageDetails were found, so this is safe to apply.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3602ff6 and d1964fd.

📒 Files selected for processing (4)
  • apps/api/plane/app/views/page/base.py (2 hunks)
  • apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx (1 hunks)
  • apps/web/core/services/page/project-page.service.ts (1 hunks)
  • apps/web/core/store/pages/project-page.store.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/web/core/services/page/project-page.service.ts (1)
packages/types/src/page/core.ts (1)
  • TPage (5-24)
apps/web/core/store/pages/project-page.store.ts (1)
packages/types/src/page/core.ts (1)
  • TPage (5-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (3)
apps/api/plane/app/views/page/base.py (1)

234-241: LGTM: visit tracking is now opt-in

Conditionally enqueueing recent_visited_task based on track_visit aligns with the PR goal.

apps/web/core/services/page/project-page.service.ts (1)

26-31: Make trackVisit optional and omit track_visit=false
Change the signature to trackVisit?: boolean and only pass { params: { track_visit: true } } when trackVisit is truthy—this preserves existing 4-argument calls and avoids sending track_visit=false.

apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx (1)

61-64: LGTM: tracking only on explicit page view

Passing { trackVisit: true } from the details page preserves visit logging while keeping hover fetches silent.

@pushya22 pushya22 merged commit e144ce8 into preview Aug 28, 2025
8 of 12 checks passed
@pushya22 pushya22 deleted the chore-track-page-visit branch August 28, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants