- Notifications
You must be signed in to change notification settings - Fork3k
[WEB-5681] refactor: add new event trackers#8293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:preview
Are you sure you want to change the base?
Conversation
… chore-event-updates
…ameter and update event tracking in workspace creation
…ameter and update event tracking in workspace creation
coderabbitaibot commentedDec 10, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a new user field Changes
Sequence Diagram(s)sequenceDiagram participant User participant Frontend participant EventHelper as Event-Tracker-V2 participant PostHog User->>Frontend: create project / page / work item / cycle Frontend->>EventHelper: compute role, call trackXCreated(payload, role) EventHelper->>PostHog: identify/join group (if needed) + capture event PostHog-->>EventHelper: ack EventHelper-->>Frontend: (no-op/async)sequenceDiagram participant Client participant BackendAPI participant CeleryTask as track_event.delay participant BGTask as event_tracking_task.track_event participant WorkspaceModel as Workspace participant PostHog Client->>BackendAPI: accept/join workspace or send invite BackendAPI->>CeleryTask: enqueue track_event.delay(user_id, event, slug, props) CeleryTask->>BGTask: run track_event(user_id, event, slug, props) BGTask->>WorkspaceModel: load workspace (for role/ownership) BGTask->>PostHog: preprocess props, include groups, capture event PostHog-->>BGTask: ackEstimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for usingCodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… chore-event-updates
…d page creation components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull request overview
This PR refactors event tracking by introducing a new v2 event tracking system. The changes replace the old event tracking implementation with a more structured approach using PostHog, adding user identification, workspace group tracking, and standardized event tracking functions.
Key changes:
- New event tracker v2 helper module with standardized tracking functions for lifecycle and product activation events
- Updated event tracking calls across the codebase to use the new v2 tracking system
- Added
last_login_timefield to user types and serializers - Backend changes to support the new event tracking infrastructure with a generic
track_eventtask
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/types/src/users.ts | Addedlast_login_time field to IUser interface |
| apps/web/ee/helpers/event-tracker-v2.helper.ts | Created EE export for event tracker v2 helper |
| apps/web/core/lib/posthog-provider.tsx | Refactored PostHog provider to use new v2 identification and workspace group tracking |
| apps/web/core/components/workspace/delete-workspace-form.tsx | Updated workspace deletion to use v2 event tracking |
| apps/web/core/components/workspace/create-workspace-form.tsx | Updated workspace creation to use v2 event tracking |
| apps/web/core/components/pages/pages-list-main-content.tsx | Updated page creation to use v2 event tracking |
| apps/web/core/components/pages/modals/create-page-modal.tsx | Updated page modal creation to use v2 event tracking |
| apps/web/core/components/onboarding/steps/workspace/create.tsx | Updated onboarding workspace creation to use v2 event tracking |
| apps/web/core/components/onboarding/create-workspace.tsx | Updated onboarding workspace creation to use v2 event tracking |
| apps/web/core/components/issues/issue-modal/base.tsx | Updated issue creation/update to use v2 event tracking |
| apps/web/core/components/issues/issue-layouts/quick-add/root.tsx | Updated quick-add issue creation to use v2 event tracking |
| apps/web/core/components/inbox/modals/create-modal/create-root.tsx | Updated inbox issue creation to use v2 event tracking |
| apps/web/core/components/cycles/modal.tsx | Updated cycle creation to use v2 event tracking |
| apps/web/ce/helpers/event-tracker-v2.helper.ts | Created new event tracker v2 helper with standardized tracking functions |
| apps/web/ce/components/projects/create/root.tsx | Updated project creation to use v2 event tracking |
| apps/web/app/(all)/invitations/page.tsx | Updated invitation acceptance to use v2 workspace group tracking |
| apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx | Updated page header creation to use v2 event tracking |
| apps/api/plane/bgtasks/event_tracking_task.py | Refactored backend event tracking with new generic track_event task |
| apps/api/plane/authentication/utils/workspace_project_join.py | Added event tracking for workspace joins |
| apps/api/plane/app/views/workspace/invite.py | Added event tracking for workspace invitations and acceptances |
| apps/api/plane/app/serializers/user.py | Addedlast_login_time to user serializer |
💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| workspace=Workspace.objects.get(slug=slug) | ||
| ifstr(workspace.owner_id)==str(user_id): | ||
| data_properties["role"]="owner" | ||
| else: | ||
| data_properties["role"]="admin" |
CopilotAIDec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The function usesWorkspace.objects.get(slug=slug) without error handling. If the workspace doesn't exist, this will raise aWorkspace.DoesNotExist exception that will be caught by the generic exception handler intrack_event, causing the event tracking to fail silently. Add proper error handling or document that the workspace must exist.
| workspace=Workspace.objects.get(slug=slug) | |
| ifstr(workspace.owner_id)==str(user_id): | |
| data_properties["role"]="owner" | |
| else: | |
| data_properties["role"]="admin" | |
| try: | |
| workspace=Workspace.objects.get(slug=slug) | |
| ifstr(workspace.owner_id)==str(user_id): | |
| data_properties["role"]="owner" | |
| else: | |
| data_properties["role"]="admin" | |
| exceptWorkspace.DoesNotExist: | |
| logger.error(f"Workspace with slug '{slug}' does not exist when processing event '{event_name}'.") | |
| data_properties["role"]="unknown" |
| ifstr(workspace.owner_id)==str(user_id): | ||
| data_properties["role"]="owner" | ||
| else: | ||
| data_properties["role"]="admin" |
CopilotAIDec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The logic assumes that if a user is not the workspace owner, they must be an admin. However, the invitee could have any role (guest, member, admin). The actual role should come fromdata_properties['invitee_role'] which is passed in the event properties from the workspace invite view.
| data_properties["role"]="admin" | |
| data_properties["role"]=data_properties.get("invitee_role") |
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Actionable comments posted: 12
🧹 Nitpick comments (18)
apps/web/app/(all)/invitations/page.tsx (1)
32-32:Workspace group tracking wiring is correct; consider simplifying the null-checkUsing
joinWorkspaceGroup(redirectWorkspace)here is the right move and aligns this page with the new v2 tracker.You can simplify the nested condition without changing behavior:
- const redirectWorkspace = invitations?.find((i) => i.id === firstInviteId)?.workspace;- if (redirectWorkspace?.id) {- if (redirectWorkspace) {- joinWorkspaceGroup(redirectWorkspace);- }- }+ const redirectWorkspace = invitations?.find((i) => i.id === firstInviteId)?.workspace;+ if (redirectWorkspace?.id) {+ joinWorkspaceGroup(redirectWorkspace);+ }Also applies to: 83-87
apps/api/plane/app/serializers/user.py (1)
27-52:last_login_time exposure and read-only behavior look correctAdding
"last_login_time"toread_only_fieldsand toUserMeSerializer.Meta.fieldsmatches the new user type and keeps the field server-controlled; no functional issues here.Minor cleanup (non-blocking):
UserMeSerializer.Meta.fieldslists"is_email_verified"twice; you can safely drop one occurrence.Also applies to: 59-83
apps/api/plane/app/views/workspace/invite.py (1)
24-26:Event tracking for workspace invites and joins is correctly integrated; consider ISO timestampsThe new
track_event.delay(...)calls on:
- invite creation (
user_invited_to_workspace), and- workspace join flows (
user_joined_workspacefor single and bulk joins)are wired with coherent properties (
user_id,workspace_id,workspace_slug, role, and invite/join timestamps) and match thetrack_eventtask signature.For slightly cleaner payloads, you might prefer ISO-formatted timestamps over
str(timezone.now()):- "invited_at": str(timezone.now()),+ "invited_at": timezone.now().isoformat(),@@- "joined_at": str(timezone.now()),+ "joined_at": timezone.now().isoformat(),This is non-blocking but improves downstream parsing.
Also applies to: 124-136, 202-213, 270-282
apps/web/core/components/workspace/create-workspace-form.tsx (1)
18-24:Unused import and inconsistent import ordering.The
captureSuccessimport on line 18 appears to be unused after this refactor. Additionally, the new imports at lines 23-24 should follow the established grouping pattern in this file (helpers before hooks, with proper comment sections).-import { captureError, captureSuccess } from "@/helpers/event-tracker.helper";+import { captureError } from "@/helpers/event-tracker.helper";+import { getUserRoleString, trackWorkspaceCreated } from "@/plane-web/helpers/event-tracker-v2.helper"; import { useWorkspace } from "@/hooks/store/use-workspace"; import { useAppRouter } from "@/hooks/use-app-router";+import { useUser, useUserPermissions } from "@/hooks/store/user"; // services import { WorkspaceService } from "@/plane-web/services";-import { getUserRoleString, trackWorkspaceCreated } from "@/plane-web/helpers/event-tracker-v2.helper";-import { useUser, useUserPermissions } from "@/hooks/store/user";apps/web/core/components/issues/issue-modal/base.tsx (1)
31-33:Import ordering inconsistency.The new imports are placed after local component imports. They should be grouped with other helpers and hooks earlier in the import section to maintain consistency.
// hooks import { captureError, captureSuccess } from "@/helpers/event-tracker.helper";+import { getUserRoleString, trackWorkItemCreated } from "@/plane-web/helpers/event-tracker-v2.helper"; import { useIssueModal } from "@/hooks/context/use-issue-modal"; import { useCycle } from "@/hooks/store/use-cycle"; import { useIssueDetail } from "@/hooks/store/use-issue-detail"; import { useIssues } from "@/hooks/store/use-issues"; import { useModule } from "@/hooks/store/use-module"; import { useProject } from "@/hooks/store/use-project";+import { useWorkspace } from "@/hooks/store/use-workspace";+import { useUser, useUserPermissions } from "@/hooks/store/user"; import { useIssueStoreType } from "@/hooks/use-issue-layout-store"; import { useIssuesActions } from "@/hooks/use-issues-actions"; // ...-import { getUserRoleString, trackWorkItemCreated } from "@/plane-web/helpers/event-tracker-v2.helper";-import { useWorkspace } from "@/hooks/store/use-workspace";-import { useUser, useUserPermissions } from "@/hooks/store/user";apps/web/core/components/pages/modals/create-page-modal.tsx (2)
17-19:Import ordering inconsistency.The new imports should be grouped with related imports. The toast import at line 11 and the helper/hook imports at lines 17-19 are scattered.
96-100:Hardcoded English strings should use i18n.The error toast uses hardcoded English strings
"Error!"and"Page could not be created...". Other components in this PR uset()translations for user-facing text. Consider using the translation function for consistency.setToast({ type: TOAST_TYPE.ERROR,- title: "Error!",- message: error?.data?.error || "Page could not be created. Please try again.",+ title: t("error"),+ message: error?.data?.error || t("page_creation_failed"), });apps/web/core/components/issues/issue-layouts/quick-add/root.tsx (2)
15-22:Unused importcaptureSuccess.The
captureSuccessimport on line 15 appears to be unused after this refactor.-import { captureError, captureSuccess } from "@/helpers/event-tracker.helper";+import { captureError } from "@/helpers/event-tracker.helper";
139-158:Using synthetic timestamp instead of response data.Line 145 uses
new Date().toISOString()forcreated_atinstead ofquickAddRes.created_at. Other components in this PR (e.g.,base.tsx) use the actualresponse.created_atfrom the API. Using a client-side timestamp may introduce slight discrepancies between the tracked event and the actual server-recorded creation time.try { if (currentWorkspace && currentUser && quickAddRes) { const role = getWorkspaceRoleByWorkspaceSlug(currentWorkspace.slug); trackWorkItemCreated(- { id: quickAddRes.id, created_at: new Date().toISOString() },+ { id: quickAddRes.id, created_at: quickAddRes.created_at }, { id: projectId.toString() }, currentWorkspace, currentUser, getUserRoleString(role) ); }apps/web/core/components/pages/pages-list-main-content.tsx (2)
18-24:Unused import and inconsistent import ordering.The
captureSuccessimport on line 18 appears to be unused after this refactor. Additionally, the new imports at lines 23-24 are placed inconsistently between existing import groups.-import { captureClick, captureError, captureSuccess } from "@/helpers/event-tracker.helper";+import { captureClick, captureError } from "@/helpers/event-tracker.helper";+import { getUserRoleString, trackPageCreated } from "@/plane-web/helpers/event-tracker-v2.helper"; import { useProject } from "@/hooks/store/use-project"; import { useUser, useUserPermissions } from "@/hooks/store/user";+import { useWorkspace } from "@/hooks/store/use-workspace"; // plane web hooks import { EPageStoreType, usePageStore } from "@/plane-web/hooks/store";-import { useWorkspace } from "@/hooks/store/use-workspace";-import { getUserRoleString, trackPageCreated } from "@/plane-web/helpers/event-tracker-v2.helper";
67-76:Using synthetic timestamp instead of response data.Line 70 uses
new Date().toISOString()forcreated_atinstead ofres.created_at. This is inconsistent with other components in this PR that use the actual response timestamp. Using server-provided timestamps ensures accurate tracking data..then((res) => { if (currentWorkspace && currentUser && res?.id) { const role = getWorkspaceRoleByWorkspaceSlug(currentWorkspace.slug); trackPageCreated(- { id: res.id, created_at: new Date().toISOString() },+ { id: res.id, created_at: res.created_at ?? new Date().toISOString() }, currentWorkspace, currentUser, "project", getUserRoleString(role) ); }apps/web/core/components/onboarding/steps/workspace/create.tsx (1)
28-28:Import placement inconsistency.This import is placed after the local component import, breaking the established import order. It should be grouped with the other
@/plane-web/imports near line 24-25.-// local components-import { CommonOnboardingHeader } from "../common";-import { getUserRoleString, trackWorkspaceCreated } from "@/plane-web/helpers/event-tracker-v2.helper";+import { getUserRoleString, trackWorkspaceCreated } from "@/plane-web/helpers/event-tracker-v2.helper";+// local components+import { CommonOnboardingHeader } from "../common";apps/web/core/components/inbox/modals/create-modal/create-root.tsx (3)
32-33:Import placement inconsistency.These imports are placed after local component imports (lines 29-31). Group them with their respective categories:
@/plane-web/imports near line 23-25 and@/hooks/imports near lines 16-21.import { useProject } from "@/hooks/store/use-project"; import { useProjectInbox } from "@/hooks/store/use-project-inbox"; import { useWorkspace } from "@/hooks/store/use-workspace";+import { useUser, useUserPermissions } from "@/hooks/store/user"; import { useAppRouter } from "@/hooks/use-app-router"; ... import { useDebouncedDuplicateIssues } from "@/plane-web/hooks/use-debounced-duplicate-issues";+import { getUserRoleString, trackWorkItemCreated } from "@/plane-web/helpers/event-tracker-v2.helper"; // services
70-74:Consolidate duplicateuseWorkspacecalls.The
useWorkspacehook is called twice. Consolidate into a single destructure:-const { getWorkspaceBySlug } = useWorkspace();+const { getWorkspaceBySlug, currentWorkspace } = useWorkspace(); const workspaceId = getWorkspaceBySlug(workspaceSlug)?.id; const { isMobile } = usePlatformOS(); const { getProjectById } = useProject();-const { currentWorkspace } = useWorkspace();
165-189:Redundant optional chaining after guard.After the guard on line 165,
res.issueis guaranteed to exist. The subsequent optional chaining (res.issue?.id,res?.issue?.id) is redundant. Consider using non-null assertion or removing the chaining for clarity:-if (!res?.issue) return;+if (!res.issue) return; if (uploadedAssetIds.length > 0) {- await fileService.updateBulkProjectAssetsUploadStatus(workspaceSlug, projectId, res.issue?.id ?? "", {+ await fileService.updateBulkProjectAssetsUploadStatus(workspaceSlug, projectId, res.issue.id, { asset_ids: uploadedAssetIds, }); ... } if (!createMore) {- router.push(`...inboxIssueId=${res.issue?.id}`);+ router.push(`...inboxIssueId=${res.issue.id}`); ... } if (currentWorkspace && currentUser) { ... trackWorkItemCreated(- { id: res?.issue?.id ?? "", created_at: res.issue?.created_at ?? "" },+ { id: res.issue.id, created_at: res.issue.created_at ?? "" }, ... ); }apps/web/ce/components/projects/create/root.tsx (1)
1-24:Import organization needs cleanup.The imports are disorganized with mixed ordering patterns. Consider grouping by category:
+import { useState } from "react";+import { observer } from "mobx-react";+import { FormProvider, useForm } from "react-hook-form";+// plane imports import { PROJECT_TRACKER_EVENTS } from "@plane/constants"; import { useTranslation } from "@plane/i18n";-import { observer } from "mobx-react";-import { useState } from "react";-import { FormProvider, useForm } from "react-hook-form";-// ui import { TOAST_TYPE, setToast } from "@plane/propel/toast"; import { EFileAssetType } from "@plane/types";-// constants+// components import ProjectCommonAttributes from "@/components/project/create/common-attributes"; ... // hooks-import { getCoverImageType, uploadCoverImage } from "@/helpers/cover-image.helper";-import { captureError } from "@/helpers/event-tracker.helper"; import { useProject } from "@/hooks/store/use-project";-import { usePlatformOS } from "@/hooks/use-platform-os";-// plane web types import { useWorkspace } from "@/hooks/store/use-workspace"; import { useUser, useUserPermissions } from "@/hooks/store/user";+import { usePlatformOS } from "@/hooks/use-platform-os";+// helpers+import { getCoverImageType, uploadCoverImage } from "@/helpers/cover-image.helper";+import { captureError } from "@/helpers/event-tracker.helper";+// plane-web imports import { getUserRoleString, trackProjectCreated } from "@/plane-web/helpers/event-tracker-v2.helper";apps/web/core/components/onboarding/create-workspace.tsx (1)
46-48:UnusedcurrentWorkspacevariable.
currentWorkspaceis destructured fromuseWorkspace()but never used in this component.- const { createWorkspace, fetchWorkspaces, currentWorkspace } = useWorkspace();+ const { createWorkspace, fetchWorkspaces } = useWorkspace();apps/web/ce/helpers/event-tracker-v2.helper.ts (1)
5-5:ExportTUserRoletype for external consumers.
TUserRoleis used as a parameter type in exported functions (e.g.,trackEvent,trackWorkspaceCreated). Consumers may need to reference this type when calling these functions.-type TUserRole = "guest" | "member" | "admin" | "unknown";+export type TUserRole = "guest" | "member" | "admin" | "unknown";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
apps/api/plane/app/serializers/user.py(1 hunks)apps/api/plane/app/views/workspace/invite.py(4 hunks)apps/api/plane/authentication/utils/workspace_project_join.py(2 hunks)apps/api/plane/bgtasks/event_tracking_task.py(2 hunks)apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx(3 hunks)apps/web/app/(all)/invitations/page.tsx(2 hunks)apps/web/ce/components/projects/create/root.tsx(4 hunks)apps/web/ce/helpers/event-tracker-v2.helper.ts(1 hunks)apps/web/core/components/cycles/modal.tsx(3 hunks)apps/web/core/components/inbox/modals/create-modal/create-root.tsx(3 hunks)apps/web/core/components/issues/issue-layouts/quick-add/root.tsx(3 hunks)apps/web/core/components/issues/issue-modal/base.tsx(4 hunks)apps/web/core/components/onboarding/create-workspace.tsx(3 hunks)apps/web/core/components/onboarding/steps/workspace/create.tsx(3 hunks)apps/web/core/components/pages/modals/create-page-modal.tsx(4 hunks)apps/web/core/components/pages/pages-list-main-content.tsx(3 hunks)apps/web/core/components/workspace/create-workspace-form.tsx(3 hunks)apps/web/core/components/workspace/delete-workspace-form.tsx(3 hunks)apps/web/core/lib/posthog-provider.tsx(2 hunks)apps/web/ee/helpers/event-tracker-v2.helper.ts(1 hunks)packages/types/src/users.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,mts,cts}
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.{ts,tsx,mts,cts}: Useconsttype parameters for more precise literal inference in TypeScript 5.0+
Use thesatisfiesoperator to validate types without widening them
Leverage inferred type predicates to reduce the need for explicitisreturn types in filter/check functions
UseNoInfer<T>utility to block inference for specific type arguments when they should be determined by other arguments
Utilize narrowing inswitch(true)blocks for control flow analysis (TypeScript 5.3+)
Rely on narrowing from direct boolean comparisons for type guards
Trust preserved narrowing in closures when variables aren't modified after the check (TypeScript 5.4+)
Use constant indices to narrow object/array properties (TypeScript 5.5+)
Use standard ECMAScript decorators (Stage 3) instead of legacyexperimentalDecorators
Useusingdeclarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)
Usewith { type: "json" }for import attributes; avoid deprecatedassertsyntax (TypeScript 5.3/5.8+)
Useimport typeexplicitly when importing types to ensure they are erased during compilation, respectingverbatimModuleSyntaxflag
Use.ts,.mts,.ctsextensions inimport typestatements (TypeScript 5.2+)
Useimport type { Type } from "mod" with { "resolution-mode": "import" }for specific module resolution contexts (TypeScript 5.3+)
Use new iterator methods (map, filter, etc.) if targeting modern environments (TypeScript 5.6+)
Utilize newSetmethods likeunion,intersection, etc., when available (TypeScript 5.5+)
UseObject.groupBy/Map.groupBystandard methods for grouping instead of external libraries (TypeScript 5.4+)
UsePromise.withResolvers()for creating promises with exposed resolve/reject functions (TypeScript 5.7+)
Use copying array methods (toSorted,toSpliced,with) for immutable array operations (TypeScript 5.2+)
Avoid accessing instance fields viasuperin classes (TypeScript 5....
Files:
apps/web/app/(all)/invitations/page.tsxpackages/types/src/users.tsapps/web/core/components/workspace/create-workspace-form.tsxapps/web/ce/components/projects/create/root.tsxapps/web/core/components/inbox/modals/create-modal/create-root.tsxapps/web/core/components/onboarding/steps/workspace/create.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/cycles/modal.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsxapps/web/core/components/issues/issue-modal/base.tsxapps/web/ee/helpers/event-tracker-v2.helper.tsapps/web/core/components/pages/pages-list-main-content.tsxapps/web/core/components/workspace/delete-workspace-form.tsxapps/web/core/lib/posthog-provider.tsxapps/web/ce/helpers/event-tracker-v2.helper.tsapps/web/core/components/onboarding/create-workspace.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Enable TypeScript strict mode and ensure all files are fully typed
Files:
apps/web/app/(all)/invitations/page.tsxpackages/types/src/users.tsapps/web/core/components/workspace/create-workspace-form.tsxapps/web/ce/components/projects/create/root.tsxapps/web/core/components/inbox/modals/create-modal/create-root.tsxapps/web/core/components/onboarding/steps/workspace/create.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/cycles/modal.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsxapps/web/core/components/issues/issue-modal/base.tsxapps/web/ee/helpers/event-tracker-v2.helper.tsapps/web/core/components/pages/pages-list-main-content.tsxapps/web/core/components/workspace/delete-workspace-form.tsxapps/web/core/lib/posthog-provider.tsxapps/web/ce/helpers/event-tracker-v2.helper.tsapps/web/core/components/onboarding/create-workspace.tsx
**/*.{js,jsx,ts,tsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with Tailwind plugin for code formatting, run
pnpm fix:format
Files:
apps/web/app/(all)/invitations/page.tsxpackages/types/src/users.tsapps/web/core/components/workspace/create-workspace-form.tsxapps/web/ce/components/projects/create/root.tsxapps/web/core/components/inbox/modals/create-modal/create-root.tsxapps/web/core/components/onboarding/steps/workspace/create.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/cycles/modal.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsxapps/web/core/components/issues/issue-modal/base.tsxapps/web/ee/helpers/event-tracker-v2.helper.tsapps/web/core/components/pages/pages-list-main-content.tsxapps/web/core/components/workspace/delete-workspace-form.tsxapps/web/core/lib/posthog-provider.tsxapps/web/ce/helpers/event-tracker-v2.helper.tsapps/web/core/components/onboarding/create-workspace.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,jsx,ts,tsx}: Use ESLint with shared config across packages, adhering to max warnings limits per package
Use camelCase for variable and function names, PascalCase for components and types
Use try-catch with proper error types and log errors appropriately
Files:
apps/web/app/(all)/invitations/page.tsxpackages/types/src/users.tsapps/web/core/components/workspace/create-workspace-form.tsxapps/web/ce/components/projects/create/root.tsxapps/web/core/components/inbox/modals/create-modal/create-root.tsxapps/web/core/components/onboarding/steps/workspace/create.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/cycles/modal.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsxapps/web/core/components/issues/issue-modal/base.tsxapps/web/ee/helpers/event-tracker-v2.helper.tsapps/web/core/components/pages/pages-list-main-content.tsxapps/web/core/components/workspace/delete-workspace-form.tsxapps/web/core/lib/posthog-provider.tsxapps/web/ce/helpers/event-tracker-v2.helper.tsapps/web/core/components/onboarding/create-workspace.tsx
🧠 Learnings (8)
📚 Learning: 2025-10-21T17:22:05.204Z
Learnt from: lifeiscontentRepo: makeplane/plane PR: 7989File: apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx:45-46Timestamp: 2025-10-21T17:22:05.204ZLearning: In the makeplane/plane repository, the refactor from useParams() to params prop is specifically scoped to page.tsx and layout.tsx files in apps/web/app (Next.js App Router pattern). Other components (hooks, regular client components, utilities) should continue using the useParams() hook as that is the correct pattern for non-route components.Applied to files:
apps/web/core/components/workspace/create-workspace-form.tsxapps/web/ce/components/projects/create/root.tsxapps/web/core/components/onboarding/steps/workspace/create.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsxapps/web/core/components/pages/pages-list-main-content.tsxapps/web/core/components/workspace/delete-workspace-form.tsxapps/web/core/lib/posthog-provider.tsx
📚 Learning: 2025-09-02T08:14:49.260Z
Learnt from: sriramveeraghantaRepo: makeplane/plane PR: 7697File: apps/web/app/(all)/[workspaceSlug]/(projects)/header.tsx:12-13Timestamp: 2025-09-02T08:14:49.260ZLearning: The star-us-link.tsx file in apps/web/app/(all)/[workspaceSlug]/(projects)/ already has "use client" directive at the top, making it a proper Client Component for hook usage.Applied to files:
apps/web/core/components/workspace/create-workspace-form.tsxapps/web/core/components/inbox/modals/create-modal/create-root.tsxapps/web/core/components/onboarding/steps/workspace/create.tsxapps/web/core/components/pages/pages-list-main-content.tsxapps/web/core/components/workspace/delete-workspace-form.tsxapps/web/core/components/onboarding/create-workspace.tsx
📚 Learning: 2025-07-23T18:18:06.875Z
Learnt from: NarayanBavisettiRepo: makeplane/plane PR: 7460File: apps/api/plane/app/serializers/draft.py:112-122Timestamp: 2025-07-23T18:18:06.875ZLearning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.Applied to files:
apps/api/plane/authentication/utils/workspace_project_join.pyapps/web/ce/components/projects/create/root.tsxapps/api/plane/app/views/workspace/invite.pyapps/web/core/components/issues/issue-modal/base.tsx
📚 Learning: 2025-10-09T20:42:31.843Z
Learnt from: lifeiscontentRepo: makeplane/plane PR: 7922File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19Timestamp: 2025-10-09T20:42:31.843ZLearning: In the makeplane/plane repository, React types are globally available through TypeScript configuration. Type annotations like React.FC, React.ReactNode, etc. can be used without explicitly importing the React namespace. The codebase uses the modern JSX transform, so React imports are not required for JSX or type references.Applied to files:
apps/web/ce/components/projects/create/root.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsxapps/web/core/lib/posthog-provider.tsx
📚 Learning: 2025-10-09T22:12:26.424Z
Learnt from: lifeiscontentRepo: makeplane/plane PR: 7922File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19Timestamp: 2025-10-09T22:12:26.424ZLearning: When `types/react` is installed in a TypeScript project (which is standard for React + TypeScript codebases), React types (React.FC, React.ReactNode, React.ComponentProps, etc.) are globally available by design. These type annotations can and should be used without explicitly importing the React namespace. This is a TypeScript/DefinitelyTyped feature, not codebase-specific configuration.Applied to files:
apps/web/core/components/pages/modals/create-page-modal.tsx
📚 Learning: 2025-12-12T15:20:36.519Z
Learnt from: CRRepo: makeplane/plane PR: 0File: AGENTS.md:0-0Timestamp: 2025-12-12T15:20:36.519ZLearning: Applies to packages/shared-state/**/*.{ts,tsx} : Maintain MobX stores in `packages/shared-state` using reactive patternsApplied to files:
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx
📚 Learning: 2025-10-10T13:25:14.810Z
Learnt from: gakshitaRepo: makeplane/plane PR: 7949File: apps/web/core/components/issues/issue-modal/form.tsx:183-189Timestamp: 2025-10-10T13:25:14.810ZLearning: In `apps/web/core/components/issues/issue-modal/form.tsx`, the form reset effect uses a `dataResetProperties` dependency array prop (default: []) to give parent components explicit control over when the form resets. Do not suggest adding the `data` prop itself to the dependency array, as this would cause unwanted resets on every render when the data object reference changes, disrupting user input. The current pattern is intentional and allows the parent to trigger resets only when specific conditions are met.Applied to files:
apps/web/core/components/issues/issue-modal/base.tsx
📚 Learning: 2025-12-12T15:20:36.519Z
Learnt from: CRRepo: makeplane/plane PR: 0File: AGENTS.md:0-0Timestamp: 2025-12-12T15:20:36.519ZLearning: Applies to **/package.json : Use `workspace:*` for internal packages and `catalog:` for external dependencies in importsApplied to files:
apps/web/core/components/workspace/delete-workspace-form.tsx
🧬 Code graph analysis (14)
apps/web/app/(all)/invitations/page.tsx (1)
apps/web/ce/helpers/event-tracker-v2.helper.ts (1)
joinWorkspaceGroup(83-96)
apps/api/plane/authentication/utils/workspace_project_join.py (2)
apps/api/plane/db/models/workspace.py (2)
WorkspaceMember(194-224)WorkspaceMemberInvite(227-251)apps/api/plane/bgtasks/event_tracking_task.py (1)
track_event(48-67)
apps/web/ce/components/projects/create/root.tsx (3)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackProjectCreated(174-191)getUserRoleString(19-33)
apps/web/core/components/inbox/modals/create-modal/create-root.tsx (3)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackWorkItemCreated(196-216)getUserRoleString(19-33)
apps/web/core/components/onboarding/steps/workspace/create.tsx (2)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackWorkspaceCreated(134-147)getUserRoleString(19-33)
apps/web/core/components/issues/issue-layouts/quick-add/root.tsx (4)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackWorkItemCreated(196-216)getUserRoleString(19-33)packages/constants/src/event-tracker/core.ts (1)
WORK_ITEM_TRACKER_EVENTS(127-148)
apps/web/core/components/pages/modals/create-page-modal.tsx (4)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackPageCreated(246-266)getUserRoleString(19-33)packages/propel/src/toast/toast.tsx (1)
setToast(202-222)
apps/api/plane/bgtasks/event_tracking_task.py (2)
apps/api/plane/db/models/workspace.py (1)
Workspace(115-178)apps/api/plane/utils/exception_logger.py (1)
log_exception(9-20)
apps/web/core/components/cycles/modal.tsx (3)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackCycleCreated(221-241)getUserRoleString(19-33)
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx (6)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackPageCreated(246-266)getUserRoleString(19-33)apps/space/core/store/publish/publish.store.ts (1)
workspaceSlug(93-95)apps/web/core/store/project/project.store.ts (1)
currentProjectDetails(214-217)packages/constants/src/event-tracker/core.ts (1)
PROJECT_PAGE_TRACKER_EVENTS(205-218)
apps/web/core/components/pages/pages-list-main-content.tsx (3)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackPageCreated(246-266)getUserRoleString(19-33)
apps/web/core/components/workspace/delete-workspace-form.tsx (1)
apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackWorkspaceDeleted(152-163)getUserRoleString(19-33)
apps/web/ce/helpers/event-tracker-v2.helper.ts (3)
packages/types/src/users.ts (2)
IUser(29-48)TUserProfile(57-84)packages/services/src/user/user.service.ts (1)
profile(52-58)packages/types/src/workspace.ts (1)
IWorkspace(15-31)
apps/web/core/components/onboarding/create-workspace.tsx (2)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackWorkspaceCreated(134-147)getUserRoleString(19-33)
⏰ 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 packages
🔇 Additional comments (11)
packages/types/src/users.ts (1)
29-48:IUser:last_login_timeaddition looks consistent
last_login_time: string | nullaligns with existing date fields (e.g.,date_joined: string) and the serializer exposure; no issues from a typing standpoint.apps/web/ee/helpers/event-tracker-v2.helper.ts (1)
1-1:Thin re-export correctly mirrors CE event tracker helperRe-exporting from
"ce/helpers/event-tracker-v2.helper"gives EE code the same API surface as CE without duplication; this is a good pattern for keeping the helpers in sync.apps/web/core/lib/posthog-provider.tsx (1)
4-6:PostHog identity & workspace grouping are wired correctly with v2 helpersThe new effects that:
- call
identifyUser(user, profile)whenuser && profile && hydrated && is_posthog_enabled, and- call
joinWorkspaceGroup(currentWorkspace)whencurrentWorkspace && hydrated && is_posthog_enabledare correctly gated on both hydration and telemetry configuration, so they won’t fire before PostHog is initialized. The use of
import type { ReactNode }here also matches the TypeScript type-only import guideline.Also applies to: 8-13, 23-28, 36-47
apps/web/core/components/issues/issue-modal/base.tsx (1)
249-258:LGTM!The work item creation tracking is well-guarded with proper null checks for
currentWorkspace,currentUser, andresponse. Usingresponse.created_atfrom the actual API response is the correct approach for accurate tracking.apps/web/ce/components/projects/create/root.tsx (1)
106-126:LGTM!The event tracking integration is well-guarded with proper null checks for
currentUser,currentWorkspace, andres. The tracking call is correctly positioned after successful project creation and before the success toast.apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsx (1)
40-81:Good refactor to async/await pattern.The conversion from promise chaining to async/await with try/catch/finally is clean. The
finallyblock properly ensures the loading state is reset regardless of success or failure.apps/web/core/components/onboarding/create-workspace.tsx (1)
82-89:Role lookup on newly created workspace may returnundefined.
getWorkspaceRoleByWorkspaceSlug(workspaceResponse.slug)is called immediately after workspace creation, but user permissions for the new workspace may not yet be in the store. This would result inrolebeingundefined, causinggetUserRoleStringto return"unknown".Since the creator is always the owner of a newly created workspace, consider passing a hardcoded owner/admin role for workspace creation events:
if (currentUser) {- const role = getWorkspaceRoleByWorkspaceSlug(workspaceResponse.slug); trackWorkspaceCreated( workspaceResponse, currentUser,- getUserRoleString(role),+ "admin", // Creator is always the workspace owner/admin ); }Alternatively, verify that
fetchWorkspaces()(or a permissions refresh) is called before the role lookup, and thatgetWorkspaceRoleByWorkspaceSlugreturns a valid role for newly created workspaces.apps/web/ce/helpers/event-tracker-v2.helper.ts (4)
49-68:Verify PII handling compliance for user email in analytics.
identifyUsersendsuser.emailto PostHog (line 54). Ensure this aligns with your privacy policy and data handling requirements (GDPR, CCPA). If email tracking is intentional for product analytics, this is acceptable; otherwise, consider using a hashed identifier or omitting it.
83-96:LGTM on workspace group tracking.Good defensive checks for
workspace.slugand handling of optionalcreated_atdate conversion. The fallbackworkspace.owner?.id || workspace.created_byreasonably handles cases where the full owner object isn't populated.
113-122:LGTM on generic event tracking.Clean implementation with proper property spreading and role inclusion. The default
"unknown"fallback for role handles edge cases appropriately.
134-147:Well-structured lifecycle and activation event trackers.The tracking functions follow a consistent pattern with proper date serialization and null handling. Good separation of concerns with dedicated functions for each entity type.
Also applies to: 152-163, 174-191, 196-216, 221-241, 246-266
| # Django imports | ||
| fromdjango.utilsimporttimezone | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Align event name with other join events and avoid list comprehension for side effects
Two things here:
- Event name inconsistency
Other join flows useevent_name="user_joined_workspace" (singular), but this path uses"user_joined_workspaces":
track_event.delay(user_id=user.id,event_name="user_joined_workspaces",# plural ...)
Unless you explicitly want adifferent event type for this code path, this will fragment analytics. To keep queries consistent, consider:
- event_name="user_joined_workspaces",+ event_name="user_joined_workspace",
- Avoid list comprehension for side effects
The comprehension:
[track_event.delay(...)forworkspace_member_inviteinworkspace_member_invites]
creates an unused list purely for side effects. A plain loop is clearer and avoids unnecessary allocation:
- [- track_event.delay(- user_id=user.id,- event_name="user_joined_workspace",- slug=workspace_member_invite.workspace.slug,- event_properties={- "user_id": user.id,- "workspace_id": workspace_member_invite.workspace.id,- "workspace_slug": workspace_member_invite.workspace.slug,- "role": workspace_member_invite.role,- "joined_at": str(timezone.now()),- },- )- for workspace_member_invite in workspace_member_invites- ]+ for workspace_member_invite in workspace_member_invites:+ track_event.delay(+ user_id=user.id,+ event_name="user_joined_workspace",+ slug=workspace_member_invite.workspace.slug,+ event_properties={+ "user_id": user.id,+ "workspace_id": workspace_member_invite.workspace.id,+ "workspace_slug": workspace_member_invite.workspace.slug,+ "role": workspace_member_invite.role,+ "joined_at": timezone.now().isoformat(),+ },+ )
(The.isoformat() change is optional but recommended for consistent timestamps.)
Also applies to: 12-12, 33-47
🤖 Prompt for AI Agents
In apps/api/plane/authentication/utils/workspace_project_join.py lines 1-3 (andalso apply to occurrences at 12-12 and 33-47), change the event_name from"user_joined_workspaces" to "user_joined_workspace" to match other join events,and replace the list comprehension used solely for side effects with an explicitfor-loop that calls track_event.delay(...) for each workspace_member_invite;optionally ensure any timestamp passed is converted with .isoformat() forconsistency.| defpreprocess_data_properties( | ||
| user_id:uuid.UUID,event_name:str,slug:str,data_properties:Dict[str,Any] | ||
| )->Dict[str,Any]: | ||
| ifevent_name=="user_invited_to_workspace": | ||
| # Check if the current user is the workspace owner | ||
| workspace=Workspace.objects.get(slug=slug) | ||
| ifstr(workspace.owner_id)==str(user_id): | ||
| data_properties["role"]="owner" | ||
| else: | ||
| data_properties["role"]="admin" | ||
| returndata_properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
UnhandledWorkspace.DoesNotExist exception can break event tracking.
Workspace.objects.get(slug=slug) will raiseWorkspace.DoesNotExist if the workspace doesn't exist (e.g., deleted or invalid slug). This exception propagates up totrack_event, where it's caught but causes the entire event to fail silently.
Consider usingfilter().first() with a null check:
def preprocess_data_properties( user_id: uuid.UUID, event_name: str, slug: str, data_properties: Dict[str, Any] ) -> Dict[str, Any]: if event_name == "user_invited_to_workspace":- # Check if the current user is the workspace owner- workspace = Workspace.objects.get(slug=slug)- if str(workspace.owner_id) == str(user_id):- data_properties["role"] = "owner"- else:- data_properties["role"] = "admin"+ workspace = Workspace.objects.filter(slug=slug).first()+ if workspace:+ if str(workspace.owner_id) == str(user_id):+ data_properties["role"] = "owner"+ else:+ data_properties["role"] = "admin"+ else:+ data_properties["role"] = "unknown" return data_properties
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| defpreprocess_data_properties( | |
| user_id:uuid.UUID,event_name:str,slug:str,data_properties:Dict[str,Any] | |
| )->Dict[str,Any]: | |
| ifevent_name=="user_invited_to_workspace": | |
| # Check if the current user is the workspace owner | |
| workspace=Workspace.objects.get(slug=slug) | |
| ifstr(workspace.owner_id)==str(user_id): | |
| data_properties["role"]="owner" | |
| else: | |
| data_properties["role"]="admin" | |
| returndata_properties | |
| defpreprocess_data_properties( | |
| user_id:uuid.UUID,event_name:str,slug:str,data_properties:Dict[str,Any] | |
| )->Dict[str,Any]: | |
| ifevent_name=="user_invited_to_workspace": | |
| workspace=Workspace.objects.filter(slug=slug).first() | |
| ifworkspace: | |
| ifstr(workspace.owner_id)==str(user_id): | |
| data_properties["role"]="owner" | |
| else: | |
| data_properties["role"]="admin" | |
| else: | |
| data_properties["role"]="unknown" | |
| returndata_properties |
🤖 Prompt for AI Agents
In apps/api/plane/bgtasks/event_tracking_task.py around lines 33-44, replace thedirect Workspace.objects.get(slug=slug) call withWorkspace.objects.filter(slug=slug).first() and add a null check so the codedoes not raise Workspace.DoesNotExist; if workspace is None, leavedata_properties unchanged (or set data_properties["role"]="unknown" if a role isrequired), otherwise perform the owner-id comparison and set "role" accordingly;this prevents an exception from propagating while preserving the intended roleassignment when the workspace exists.| @shared_task | ||
| defauth_events(user,email,user_agent,ip,event_name,medium,first_time): | ||
| try: | ||
| POSTHOG_API_KEY,POSTHOG_HOST=posthogConfiguration() | ||
| deftrack_event(user_id:uuid.UUID,event_name:str,slug:str,event_properties:Dict[str,Any]): | ||
| POSTHOG_API_KEY,POSTHOG_HOST=posthogConfiguration() | ||
| ifPOSTHOG_API_KEYandPOSTHOG_HOST: | ||
| posthog=Posthog(POSTHOG_API_KEY,host=POSTHOG_HOST) | ||
| posthog.capture( | ||
| email, | ||
| event=event_name, | ||
| properties={ | ||
| "event_id":uuid.uuid4().hex, | ||
| "user": {"email":email,"id":str(user)}, | ||
| "device_ctx": {"ip":ip,"user_agent":user_agent}, | ||
| "medium":medium, | ||
| "first_time":first_time, | ||
| }, | ||
| ) | ||
| ifnot (POSTHOG_API_KEYandPOSTHOG_HOST): | ||
| logger.warning("Event tracking is not configured") | ||
| return | ||
| try: | ||
| # preprocess the data properties for massaging the payload | ||
| # in the correct format for posthog | ||
| data_properties=preprocess_data_properties(user_id,event_name,slug,event_properties) | ||
| groups= { | ||
| "workspace":slug, | ||
| } | ||
| # track the event using posthog | ||
| posthog=Posthog(POSTHOG_API_KEY,host=POSTHOG_HOST) | ||
| posthog.capture(distinct_id=user_id,event=event_name,properties=data_properties,groups=groups) | ||
| exceptExceptionase: | ||
| log_exception(e) | ||
| return | ||
| returnFalse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Type mismatch and inconsistent return value.
Two issues in thetrack_event function:
UUID type:
user_idis typed asuuid.UUID, butposthog.capture(distinct_id=...)typically expects a string. Ensure explicit conversion to avoid serialization issues.Inconsistent return: Returns
Falseon exception (line 67) but returnsNoneimplicitly on success or when tracking is disabled. Consider consistent return behavior.
@shared_task-def track_event(user_id: uuid.UUID, event_name: str, slug: str, event_properties: Dict[str, Any]):+def track_event(user_id: uuid.UUID, event_name: str, slug: str, event_properties: Dict[str, Any]) -> bool: POSTHOG_API_KEY, POSTHOG_HOST = posthogConfiguration() if not (POSTHOG_API_KEY and POSTHOG_HOST): logger.warning("Event tracking is not configured")- return+ return False try: data_properties = preprocess_data_properties(user_id, event_name, slug, event_properties) groups = { "workspace": slug, } posthog = Posthog(POSTHOG_API_KEY, host=POSTHOG_HOST)- posthog.capture(distinct_id=user_id, event=event_name, properties=data_properties, groups=groups)+ posthog.capture(distinct_id=str(user_id), event=event_name, properties=data_properties, groups=groups)+ return True except Exception as e: log_exception(e) return False
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| @shared_task | |
| defauth_events(user,email,user_agent,ip,event_name,medium,first_time): | |
| try: | |
| POSTHOG_API_KEY,POSTHOG_HOST=posthogConfiguration() | |
| deftrack_event(user_id:uuid.UUID,event_name:str,slug:str,event_properties:Dict[str,Any]): | |
| POSTHOG_API_KEY,POSTHOG_HOST=posthogConfiguration() | |
| ifPOSTHOG_API_KEYandPOSTHOG_HOST: | |
| posthog=Posthog(POSTHOG_API_KEY,host=POSTHOG_HOST) | |
| posthog.capture( | |
| email, | |
| event=event_name, | |
| properties={ | |
| "event_id":uuid.uuid4().hex, | |
| "user": {"email":email,"id":str(user)}, | |
| "device_ctx": {"ip":ip,"user_agent":user_agent}, | |
| "medium":medium, | |
| "first_time":first_time, | |
| }, | |
| ) | |
| ifnot (POSTHOG_API_KEYandPOSTHOG_HOST): | |
| logger.warning("Event tracking is not configured") | |
| return | |
| try: | |
| # preprocess the data properties for massaging the payload | |
| # in the correct format for posthog | |
| data_properties=preprocess_data_properties(user_id,event_name,slug,event_properties) | |
| groups= { | |
| "workspace":slug, | |
| } | |
| # track the event using posthog | |
| posthog=Posthog(POSTHOG_API_KEY,host=POSTHOG_HOST) | |
| posthog.capture(distinct_id=user_id,event=event_name,properties=data_properties,groups=groups) | |
| exceptExceptionase: | |
| log_exception(e) | |
| return | |
| returnFalse | |
| @shared_task | |
| deftrack_event(user_id:uuid.UUID,event_name:str,slug:str,event_properties:Dict[str,Any])->bool: | |
| POSTHOG_API_KEY,POSTHOG_HOST=posthogConfiguration() | |
| ifnot (POSTHOG_API_KEYandPOSTHOG_HOST): | |
| logger.warning("Event tracking is not configured") | |
| returnFalse | |
| try: | |
| # preprocess the data properties for massaging the payload | |
| # in the correct format for posthog | |
| data_properties=preprocess_data_properties(user_id,event_name,slug,event_properties) | |
| groups= { | |
| "workspace":slug, | |
| } | |
| # track the event using posthog | |
| posthog=Posthog(POSTHOG_API_KEY,host=POSTHOG_HOST) | |
| posthog.capture(distinct_id=str(user_id),event=event_name,properties=data_properties,groups=groups) | |
| returnTrue | |
| exceptExceptionase: | |
| log_exception(e) | |
| returnFalse |
🤖 Prompt for AI Agents
In apps/api/plane/bgtasks/event_tracking_task.py around lines 47 to 67, convertuser_id to a string before passing it to posthog.capture (e.g.,distinct_id=str(user_id)) to avoid UUID serialization issues, and make thefunction return consistently (return True on successful capture and return Falseboth when tracking is disabled and when an exception occurs) so callers receivea boolean success indicator....b/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(list)/header.tsxShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
…nd issue creation, and reorganize imports in workspace components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (4)
apps/web/core/components/workspace/delete-workspace-form.tsx (1)
70-75:Potential timing issue: role lookup after workspace deletion.
getWorkspaceRoleByWorkspaceSlug(data.slug)is called after the workspace is deleted. The user's permissions for this workspace may already be cleared from the store, causing the role to beundefinedand tracked as"unknown".Capture the role before deletion:
const onSubmit = async () => { if (!data || !canDelete) return;+ // Capture role before deletion as permissions will be cleared+ const role = getWorkspaceRoleByWorkspaceSlug(data.slug);+ await deleteWorkspace(data.slug) .then(async () => { await fetchCurrentUserSettings(); handleClose(); router.push(getWorkspaceRedirectionUrl());- const role = getWorkspaceRoleByWorkspaceSlug(data.slug);- if (currentUser) { trackWorkspaceDeleted(data, currentUser, getUserRoleString(role)); }apps/web/core/components/pages/modals/create-page-modal.tsx (1)
74-87:Empty string fallbacks for tracking data remain unaddressed.The previous review comment flagging
pageData.id ?? ""andpageData.created_at ?? ""as potentially sending invalid tracking data still applies. Consider guarding withpageData.idcheck and using a meaningful fallback forcreated_at.apps/web/core/components/issues/issue-layouts/quick-add/root.tsx (1)
145-145:Consider using a valid fallback timestamp instead of empty string.Using an empty string as the fallback for
created_atwill result in an invalid timestamp being tracked. A client-side timestamp would be more appropriate as a fallback.- { id: quickAddRes.id, created_at: quickAddRes.created_at ?? "" },+ { id: quickAddRes.id, created_at: quickAddRes.created_at ?? new Date().toISOString() },apps/web/core/components/cycles/modal.tsx (1)
72-81:UseselectedProjectIdin tracking to match the actual cycle's project.The tracking call uses
projectIdfrom props, but if the user selects a different project in the form, the cycle will be created inselectedProjectId(line 54) while analytics records the originalprojectId. This creates incorrect analytics data.Apply this diff:
if (currentWorkspace && currentUser) { const role = getWorkspaceRoleByWorkspaceSlug(currentWorkspace.slug); trackCycleCreated( { id: res.id, created_at: res?.created_at ?? "" },- { id: projectId },+ { id: selectedProjectId }, currentWorkspace, currentUser, getUserRoleString(role) ); }
🧹 Nitpick comments (1)
apps/web/core/components/issues/issue-layouts/quick-add/root.tsx (1)
14-22:Import ordering is inconsistent.The
@/plane-web/helpers/...and@/hooks/store/...imports on lines 20-22 are placed after the local relative import on line 19. Consider grouping aliased path imports (@/...) before local relative imports (./...) for consistency.// helpers import { captureError } from "@/helpers/event-tracker.helper";+import { getUserRoleString, trackWorkItemCreated } from "@/plane-web/helpers/event-tracker-v2.helper";+import { useUser, useUserPermissions } from "@/hooks/store/user";+import { useWorkspace } from "@/hooks/store/use-workspace"; // plane web imports import { QuickAddIssueFormRoot } from "@/plane-web/components/issues/quick-add"; // local imports import { CreateIssueToastActionItems } from "../../create-issue-toast-action-items";-import { getUserRoleString, trackWorkItemCreated } from "@/plane-web/helpers/event-tracker-v2.helper";-import { useUser, useUserPermissions } from "@/hooks/store/user";-import { useWorkspace } from "@/hooks/store/use-workspace";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/web/core/components/cycles/modal.tsx(3 hunks)apps/web/core/components/issues/issue-layouts/quick-add/root.tsx(3 hunks)apps/web/core/components/onboarding/steps/workspace/create.tsx(4 hunks)apps/web/core/components/pages/modals/create-page-modal.tsx(4 hunks)apps/web/core/components/workspace/delete-workspace-form.tsx(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/web/core/components/onboarding/steps/workspace/create.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,mts,cts}
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.{ts,tsx,mts,cts}: Useconsttype parameters for more precise literal inference in TypeScript 5.0+
Use thesatisfiesoperator to validate types without widening them
Leverage inferred type predicates to reduce the need for explicitisreturn types in filter/check functions
UseNoInfer<T>utility to block inference for specific type arguments when they should be determined by other arguments
Utilize narrowing inswitch(true)blocks for control flow analysis (TypeScript 5.3+)
Rely on narrowing from direct boolean comparisons for type guards
Trust preserved narrowing in closures when variables aren't modified after the check (TypeScript 5.4+)
Use constant indices to narrow object/array properties (TypeScript 5.5+)
Use standard ECMAScript decorators (Stage 3) instead of legacyexperimentalDecorators
Useusingdeclarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)
Usewith { type: "json" }for import attributes; avoid deprecatedassertsyntax (TypeScript 5.3/5.8+)
Useimport typeexplicitly when importing types to ensure they are erased during compilation, respectingverbatimModuleSyntaxflag
Use.ts,.mts,.ctsextensions inimport typestatements (TypeScript 5.2+)
Useimport type { Type } from "mod" with { "resolution-mode": "import" }for specific module resolution contexts (TypeScript 5.3+)
Use new iterator methods (map, filter, etc.) if targeting modern environments (TypeScript 5.6+)
Utilize newSetmethods likeunion,intersection, etc., when available (TypeScript 5.5+)
UseObject.groupBy/Map.groupBystandard methods for grouping instead of external libraries (TypeScript 5.4+)
UsePromise.withResolvers()for creating promises with exposed resolve/reject functions (TypeScript 5.7+)
Use copying array methods (toSorted,toSpliced,with) for immutable array operations (TypeScript 5.2+)
Avoid accessing instance fields viasuperin classes (TypeScript 5....
Files:
apps/web/core/components/cycles/modal.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/workspace/delete-workspace-form.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Enable TypeScript strict mode and ensure all files are fully typed
Files:
apps/web/core/components/cycles/modal.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/workspace/delete-workspace-form.tsx
**/*.{js,jsx,ts,tsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with Tailwind plugin for code formatting, run
pnpm fix:format
Files:
apps/web/core/components/cycles/modal.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/workspace/delete-workspace-form.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,jsx,ts,tsx}: Use ESLint with shared config across packages, adhering to max warnings limits per package
Use camelCase for variable and function names, PascalCase for components and types
Use try-catch with proper error types and log errors appropriately
Files:
apps/web/core/components/cycles/modal.tsxapps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/issues/issue-layouts/quick-add/root.tsxapps/web/core/components/workspace/delete-workspace-form.tsx
🧠 Learnings (8)
📚 Learning: 2025-07-23T18:18:06.875Z
Learnt from: NarayanBavisettiRepo: makeplane/plane PR: 7460File: apps/api/plane/app/serializers/draft.py:112-122Timestamp: 2025-07-23T18:18:06.875ZLearning: In the Plane codebase serializers, workspace_id is not consistently passed in serializer context, so parent issue validation in DraftIssueCreateSerializer only checks project_id rather than both workspace_id and project_id. The existing project member authentication system already validates that users can only access projects they belong to, providing sufficient security without risking breaking functionality by adding workspace_id validation where the context might not be available.Applied to files:
apps/web/core/components/cycles/modal.tsxapps/web/core/components/workspace/delete-workspace-form.tsx
📚 Learning: 2025-06-16T07:23:39.497Z
Learnt from: vamsikrishnamathalaRepo: makeplane/plane PR: 7214File: web/core/store/issue/helpers/base-issues.store.ts:117-117Timestamp: 2025-06-16T07:23:39.497ZLearning: In the updateIssueDates method of BaseIssuesStore (web/core/store/issue/helpers/base-issues.store.ts), the projectId parameter is intentionally made optional to support override implementations in subclasses. The base implementation requires projectId and includes an early return check, but making it optional allows derived classes to override the method with different parameter requirements.Applied to files:
apps/web/core/components/cycles/modal.tsx
📚 Learning: 2025-06-18T09:46:08.566Z
Learnt from: prateekshourya29Repo: makeplane/plane PR: 7188File: web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/header.tsx:40-45Timestamp: 2025-06-18T09:46:08.566ZLearning: When reviewing breadcrumb components that accept projectId or similar props, check if empty strings are being passed during loading states, which can result in invalid URLs. The preferred approach is to handle these loading states internally within the component rather than requiring each consumer to manage the loading logic.Applied to files:
apps/web/core/components/pages/modals/create-page-modal.tsx
📚 Learning: 2025-10-09T20:42:31.843Z
Learnt from: lifeiscontentRepo: makeplane/plane PR: 7922File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19Timestamp: 2025-10-09T20:42:31.843ZLearning: In the makeplane/plane repository, React types are globally available through TypeScript configuration. Type annotations like React.FC, React.ReactNode, etc. can be used without explicitly importing the React namespace. The codebase uses the modern JSX transform, so React imports are not required for JSX or type references.Applied to files:
apps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/workspace/delete-workspace-form.tsx
📚 Learning: 2025-10-21T17:22:05.204Z
Learnt from: lifeiscontentRepo: makeplane/plane PR: 7989File: apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx:45-46Timestamp: 2025-10-21T17:22:05.204ZLearning: In the makeplane/plane repository, the refactor from useParams() to params prop is specifically scoped to page.tsx and layout.tsx files in apps/web/app (Next.js App Router pattern). Other components (hooks, regular client components, utilities) should continue using the useParams() hook as that is the correct pattern for non-route components.Applied to files:
apps/web/core/components/pages/modals/create-page-modal.tsxapps/web/core/components/workspace/delete-workspace-form.tsx
📚 Learning: 2025-10-09T22:12:26.424Z
Learnt from: lifeiscontentRepo: makeplane/plane PR: 7922File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19Timestamp: 2025-10-09T22:12:26.424ZLearning: When `types/react` is installed in a TypeScript project (which is standard for React + TypeScript codebases), React types (React.FC, React.ReactNode, React.ComponentProps, etc.) are globally available by design. These type annotations can and should be used without explicitly importing the React namespace. This is a TypeScript/DefinitelyTyped feature, not codebase-specific configuration.Applied to files:
apps/web/core/components/pages/modals/create-page-modal.tsx
📚 Learning: 2025-11-25T10:18:05.172Z
Learnt from: CRRepo: makeplane/plane PR: 0File: .github/instructions/typescript.instructions.md:0-0Timestamp: 2025-11-25T10:18:05.172ZLearning: Applies to **/*.{ts,tsx,mts,cts} : Use `using` declarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)Applied to files:
apps/web/core/components/workspace/delete-workspace-form.tsx
📚 Learning: 2025-09-02T08:14:49.260Z
Learnt from: sriramveeraghantaRepo: makeplane/plane PR: 7697File: apps/web/app/(all)/[workspaceSlug]/(projects)/header.tsx:12-13Timestamp: 2025-09-02T08:14:49.260ZLearning: The star-us-link.tsx file in apps/web/app/(all)/[workspaceSlug]/(projects)/ already has "use client" directive at the top, making it a proper Client Component for hook usage.Applied to files:
apps/web/core/components/workspace/delete-workspace-form.tsx
🧬 Code graph analysis (4)
apps/web/core/components/cycles/modal.tsx (3)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackCycleCreated(221-241)getUserRoleString(19-33)
apps/web/core/components/pages/modals/create-page-modal.tsx (4)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackPageCreated(246-266)getUserRoleString(19-33)packages/propel/src/toast/toast.tsx (1)
setToast(202-222)
apps/web/core/components/issues/issue-layouts/quick-add/root.tsx (4)
apps/admin/core/hooks/store/use-workspace.tsx (1)
useWorkspace(6-10)apps/web/core/store/workspace/index.ts (1)
currentWorkspace(125-130)apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackWorkItemCreated(196-216)getUserRoleString(19-33)packages/constants/src/event-tracker/core.ts (1)
WORK_ITEM_TRACKER_EVENTS(127-148)
apps/web/core/components/workspace/delete-workspace-form.tsx (1)
apps/web/ce/helpers/event-tracker-v2.helper.ts (2)
trackWorkspaceDeleted(152-163)getUserRoleString(19-33)
⏰ 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). (3)
- GitHub Check: check:types
- GitHub Check: check:lint
- GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
apps/web/core/components/workspace/delete-workspace-form.tsx (2)
1-18:LGTM!Import changes are clean. The unused
captureSuccessimport has been removed, and all new imports (useUser,useUserPermissions,getUserRoleString,trackWorkspaceDeleted,cn) are properly utilized in the component.
39-41:LGTM!Hook declarations are properly added for the new tracking functionality.
apps/web/core/components/pages/modals/create-page-modal.tsx (2)
51-53:LGTM!The hook additions for
useUserPermissions,useUser, anduseWorkspaceare correctly placed and provide the necessary context for role-aware event tracking.
96-100:Good addition of user feedback for error cases.The toast notification provides clear user feedback when page creation fails, with a sensible fallback message.
apps/web/core/components/issues/issue-layouts/quick-add/root.tsx (1)
73-77:LGTM!The store hooks are correctly placed at the component's top level and properly destructured for use in the event tracking logic.
apps/web/core/components/cycles/modal.tsx (2)
21-23:LGTM - Tracking imports are properly structured.The new imports for user context, workspace context, and tracking utilities are appropriate for implementing the event tracking functionality.
45-47:LGTM - Hook usage follows React patterns.The workspace, user, and permissions hooks are correctly initialized to provide context for tracking.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Linked to Plane Work Item(s) This comment was auto-generated byPlane |
There was a problem hiding this 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 (1)
apps/web/core/components/pages/pages-list-main-content.tsx (1)
67-76:Wrap tracking call in try-catch to isolate it from the success flow.The
trackPageCreatedcall can interrupt the page creation success flow if it throws. WhilegetUserRoleStringsafely handles undefined roles andtrackPageCreatedis implemented defensively, wrapping the tracking logic in a try-catch prevents any potential errors from blocking navigation to the newly created page.if (currentWorkspace && currentUser && res?.id) {- const role = getWorkspaceRoleByWorkspaceSlug(currentWorkspace.slug);- trackPageCreated(- { id: res.id, created_at: res.created_at ?? "" },- currentWorkspace,- currentUser,- "project",- getUserRoleString(role)- );+ try {+ const role = getWorkspaceRoleByWorkspaceSlug(currentWorkspace.slug);+ trackPageCreated(+ { id: res.id, created_at: res.created_at ?? "" },+ currentWorkspace,+ currentUser,+ "project",+ getUserRoleString(role)+ );+ } catch (error) {+ console.error("Failed to track page creation:", error);+ } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/core/components/pages/pages-list-main-content.tsx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,mts,cts}
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.{ts,tsx,mts,cts}: Useconsttype parameters for more precise literal inference in TypeScript 5.0+
Use thesatisfiesoperator to validate types without widening them
Leverage inferred type predicates to reduce the need for explicitisreturn types in filter/check functions
UseNoInfer<T>utility to block inference for specific type arguments when they should be determined by other arguments
Utilize narrowing inswitch(true)blocks for control flow analysis (TypeScript 5.3+)
Rely on narrowing from direct boolean comparisons for type guards
Trust preserved narrowing in closures when variables aren't modified after the check (TypeScript 5.4+)
Use constant indices to narrow object/array properties (TypeScript 5.5+)
Use standard ECMAScript decorators (Stage 3) instead of legacyexperimentalDecorators
Useusingdeclarations for explicit resource management with Disposable pattern instead of manual cleanup (TypeScript 5.2+)
Usewith { type: "json" }for import attributes; avoid deprecatedassertsyntax (TypeScript 5.3/5.8+)
Useimport typeexplicitly when importing types to ensure they are erased during compilation, respectingverbatimModuleSyntaxflag
Use.ts,.mts,.ctsextensions inimport typestatements (TypeScript 5.2+)
Useimport type { Type } from "mod" with { "resolution-mode": "import" }for specific module resolution contexts (TypeScript 5.3+)
Use new iterator methods (map, filter, etc.) if targeting modern environments (TypeScript 5.6+)
Utilize newSetmethods likeunion,intersection, etc., when available (TypeScript 5.5+)
UseObject.groupBy/Map.groupBystandard methods for grouping instead of external libraries (TypeScript 5.4+)
UsePromise.withResolvers()for creating promises with exposed resolve/reject functions (TypeScript 5.7+)
Use copying array methods (toSorted,toSpliced,with) for immutable array operations (TypeScript 5.2+)
Avoid accessing instance fields viasuperin classes (TypeScript 5....
Files:
apps/web/core/components/pages/pages-list-main-content.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Enable TypeScript strict mode and ensure all files are fully typed
Files:
apps/web/core/components/pages/pages-list-main-content.tsx
**/*.{js,jsx,ts,tsx,json,css}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier with Tailwind plugin for code formatting, run
pnpm fix:format
Files:
apps/web/core/components/pages/pages-list-main-content.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,jsx,ts,tsx}: Use ESLint with shared config across packages, adhering to max warnings limits per package
Use camelCase for variable and function names, PascalCase for components and types
Use try-catch with proper error types and log errors appropriately
Files:
apps/web/core/components/pages/pages-list-main-content.tsx
🧠 Learnings (2)
📚 Learning: 2025-10-21T17:22:05.204Z
Learnt from: lifeiscontentRepo: makeplane/plane PR: 7989File: apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx:45-46Timestamp: 2025-10-21T17:22:05.204ZLearning: In the makeplane/plane repository, the refactor from useParams() to params prop is specifically scoped to page.tsx and layout.tsx files in apps/web/app (Next.js App Router pattern). Other components (hooks, regular client components, utilities) should continue using the useParams() hook as that is the correct pattern for non-route components.Applied to files:
apps/web/core/components/pages/pages-list-main-content.tsx
📚 Learning: 2025-09-02T08:14:49.260Z
Learnt from: sriramveeraghantaRepo: makeplane/plane PR: 7697File: apps/web/app/(all)/[workspaceSlug]/(projects)/header.tsx:12-13Timestamp: 2025-09-02T08:14:49.260ZLearning: The star-us-link.tsx file in apps/web/app/(all)/[workspaceSlug]/(projects)/ already has "use client" directive at the top, making it a proper Client Component for hook usage.Applied to files:
apps/web/core/components/pages/pages-list-main-content.tsx
⏰ 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). (3)
- GitHub Check: check:lint
- GitHub Check: check:types
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/web/core/components/pages/pages-list-main-content.tsx (2)
20-24:LGTM! Clean import additions.The new imports for user context, permissions, and event tracking helpers are properly structured and align with the PR's objective to add event tracking capabilities.
40-43:LGTM! Proper hook usage.The hooks are correctly called at the top level and follow standard React patterns. The retrieved user and workspace context will enable conditional event tracking.
Uh oh!
There was an error while loading.Please reload this page.
Description
This PR adds new set of event trackers.
Type of Change
Screenshots and Media (if applicable)
Test Scenarios
References
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.