Skip to content

[WEB-4438] fix: epics label in y axis of epics(analytics-modal)#7644

Merged
pushya22 merged 1 commit intopreviewfrom
fix/epics-analytics-peek
Aug 25, 2025
Merged

[WEB-4438] fix: epics label in y axis of epics(analytics-modal)#7644
pushya22 merged 1 commit intopreviewfrom
fix/epics-analytics-peek

Conversation

@JayashTripathy
Copy link
Member

@JayashTripathy JayashTripathy commented Aug 25, 2025

Description

This PR will fix the wrong workitem label inside of customized insights in Epic Peek View Analytics.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

image

Test Scenarios

References

Summary by CodeRabbit

  • New Features
    • Added “Epic work item count” as a selectable Y-axis metric in analytics.
    • Analytics views can now switch into an Epic-focused mode via an optional setting.
    • Default Y-axis selection adapts based on Epic mode (Epic count vs. Work item count).
    • Analytics selectors automatically hide non-relevant Y-axis options depending on context.
    • Work Items modal and Customized Insights now respect and pass through the Epic context for consistent chart initialization and filtering.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 25, 2025

Walkthrough

Adds an optional isEpic prop across analytics components, threads it through modal -> customized insights -> select params, updates default form values and hidden Y-axis options based on isEpic, and introduces EPIC_WORK_ITEM_COUNT to ChartYAxisMetric and ANALYTICS_Y_AXIS_VALUES.

Changes

Cohort / File(s) Summary
Y-axis metric types and constants
packages/types/src/analytics.ts, packages/constants/src/analytics/common.ts
Add ChartYAxisMetric.EPIC_WORK_ITEM_COUNT enum member and include corresponding "Epic" option in ANALYTICS_Y_AXIS_VALUES.
Analytics select params
apps/web/core/components/analytics/select/analytics-params.tsx
Add optional prop isEpic. Adjust hiddenOptions for Y-axis: always hide ESTIMATE_POINT_COUNT and hide WORK_ITEM_COUNT when isEpic, else hide EPIC_WORK_ITEM_COUNT.
Customized insights form defaults
apps/web/core/components/analytics/work-items/customized-insights.tsx
Add optional prop isEpic. Inline useForm defaults: x_axis stays PRIORITY; y_axis defaults to EPIC_WORK_ITEM_COUNT when isEpic else WORK_ITEM_COUNT. Pass isEpic to AnalyticsSelectParams.
Work items modal wiring
apps/web/core/components/analytics/work-items/modal/content.tsx, apps/web/core/components/analytics/work-items/modal/index.tsx
Extend Props with optional isEpic and forward it down to CustomizedInsights/WorkItemsModalMainContent. No other logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Modal as WorkItemsModal
  participant Content as ModalMainContent
  participant Insights as CustomizedInsights
  participant Select as AnalyticsSelectParams

  User->>Modal: Open (isEpic?)
  Modal->>Content: Render with isEpic
  Content->>Insights: Render with isEpic
  Note right of Insights: Initializes form defaults<br/>x_axis=PRIORITY<br/>y_axis = isEpic ? EPIC_WORK_ITEM_COUNT : WORK_ITEM_COUNT
  Insights->>Select: Render with isEpic
  Select->>Select: Compute hiddenOptions<br/>Hide ESTIMATE_POINT_COUNT<br/>Hide (isEpic ? WORK_ITEM_COUNT : EPIC_WORK_ITEM_COUNT)
  User-->>Select: Adjust axes (optional)
  Select-->>Insights: Updated params
  Insights-->>User: PriorityChart renders with params
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

🌐frontend, ready to merge

Suggested reviewers

  • aaryan610
  • prateekshourya29

Poem

In charts I hop, a metric leap,
From work to epic, data deep.
A toggle twitch, a carrot click,
Y-axes shift—oh what a trick!
Burrowed forms now know the pick,
Thump-thump—insights, swift and slick. 🥕✨

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 fix/epics-analytics-peek

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 @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai 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 @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @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 25, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@pushya22 pushya22 merged commit b6cf3a5 into preview Aug 25, 2025
5 of 8 checks passed
@pushya22 pushya22 deleted the fix/epics-analytics-peek branch August 25, 2025 13:55
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 (5)
packages/constants/src/analytics/common.ts (1)

177-181: Confirm copy: “Epic” vs “Epics”

Title says “fix: epics label…”, but the option label is “Epic”. If the y-axis is pluralized elsewhere (“Work item” vs “Work items” is also a consideration), confirm product copy. If plural is desired, adjust:

-    label: "Epic",
+    label: "Epics",

If the screenshot/product spec expects “Epic” singular for consistency with “Work item”/“Estimate,” keep as-is.

apps/web/core/components/analytics/work-items/modal/index.tsx (1)

59-66: Propagating isEpic looks correct; consider resetting store on close to avoid stale state

Forwarding isEpic to MainContent is good. Small UX hardening: also reset isEpic in the store on close to avoid any transient stale state if peek flag updates lag behind.

 const handleClose = () => {
   setFullScreen(false);
+  // Ensure store is reset even if peek flag is updated slightly later
+  updateIsEpic(false);
   onClose();
 };
apps/web/core/components/analytics/work-items/modal/content.tsx (1)

20-25: Threading isEpic down is fine; consider explicit store reset on unmount

You pass isEpic down to CustomizedInsights, which is correct. For defensive cleanup, also reset isEpic in the analytics store during unmount, rather than relying on the sibling effect in the parent.

-  const { updateSelectedProjects, updateSelectedCycle, updateSelectedModule, updateIsPeekView } = useAnalytics();
+  const { updateSelectedProjects, updateSelectedCycle, updateSelectedModule, updateIsPeekView, updateIsEpic } = useAnalytics();
@@
     return () => {
       updateSelectedProjects([]);
       updateSelectedCycle("");
       updateSelectedModule("");
       updateIsPeekView(false);
+      updateIsEpic(false);
     };
apps/web/core/components/analytics/work-items/customized-insights.tsx (2)

13-13: Default isEpic to false to avoid undefined-driven branching

Setting a boolean default improves readability and ensures a deterministic initial state for form defaults derived from isEpic.

-const CustomizedInsights = observer(({ peekView, isEpic }: { peekView?: boolean; isEpic?: boolean }) => {
+const CustomizedInsights = observer(({ peekView, isEpic = false }: { peekView?: boolean; isEpic?: boolean }) => {

16-21: RHF defaultValues are static; sync y_axis when isEpic changes

react-hook-form applies defaultValues only on mount. If this component instance persists while isEpic toggles (e.g., switching between epic/work-item contexts without unmount), y_axis won’t update and can become invalid relative to hidden options downstream. Add an effect to reconcile y_axis whenever isEpic changes.

Diff within this block isn’t ideal for inserting an effect, so here’s the minimal addition you can place just after the useForm call (and import useEffect):

 import { useForm } from "react-hook-form";
+import { useEffect } from "react";
@@
   const { control, watch, setValue } = useForm<IAnalyticsParams>({
     defaultValues: {
       x_axis: ChartXAxisProperty.PRIORITY,
       y_axis: isEpic ? ChartYAxisMetric.EPIC_WORK_ITEM_COUNT : ChartYAxisMetric.WORK_ITEM_COUNT,
     },
   });
+
+  // Keep y_axis aligned with the epic/work-item context
+  useEffect(() => {
+    const target = isEpic ? ChartYAxisMetric.EPIC_WORK_ITEM_COUNT : ChartYAxisMetric.WORK_ITEM_COUNT;
+    setValue("y_axis", target, { shouldDirty: false, shouldTouch: false, shouldValidate: false });
+  }, [isEpic, setValue]);

Please verify UX: If users manually change y_axis, confirm whether switching contexts should preserve selection (when valid) or force the context-specific default as above.

📜 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 bbc465a and 33d9324.

📒 Files selected for processing (6)
  • apps/web/core/components/analytics/select/analytics-params.tsx (2 hunks)
  • apps/web/core/components/analytics/work-items/customized-insights.tsx (2 hunks)
  • apps/web/core/components/analytics/work-items/modal/content.tsx (2 hunks)
  • apps/web/core/components/analytics/work-items/modal/index.tsx (1 hunks)
  • packages/constants/src/analytics/common.ts (1 hunks)
  • packages/types/src/analytics.ts (1 hunks)
⏰ 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). (2)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
packages/types/src/analytics.ts (1)

31-32: Add doc for EPIC_WORK_ITEM_COUNT and confirm backend mapping

I’ve verified that the new metric is wired through the client but needs clarification and a backend check:

• Declaration
– packages/types/src/analytics.ts (line 31) – where EPIC_WORK_ITEM_COUNT is added
• UI usage
– packages/constants/src/analytics/common.ts (line 178) – used in the Y-axis options
– apps/web/core/components/analytics/work-items/customized-insights.tsx (line 19) – sets y_axis based on isEpic
– apps/web/core/components/analytics/select/analytics-params.tsx (line 48) – toggles as a hidden option for non-epic views

Apply this tiny doc tweak in packages/types/src/analytics.ts:

 export enum ChartYAxisMetric {
   WORK_ITEM_COUNT = "WORK_ITEM_COUNT",
   ESTIMATE_POINT_COUNT = "ESTIMATE_POINT_COUNT",
   PENDING_WORK_ITEM_COUNT = "PENDING_WORK_ITEM_COUNT",
   COMPLETED_WORK_ITEM_COUNT = "COMPLETED_WORK_ITEM_COUNT",
   IN_PROGRESS_WORK_ITEM_COUNT = "IN_PROGRESS_WORK_ITEM_COUNT",
   WORK_ITEM_DUE_THIS_WEEK_COUNT = "WORK_ITEM_DUE_THIS_WEEK_COUNT",
   WORK_ITEM_DUE_TODAY_COUNT = "WORK_ITEM_DUE_TODAY_COUNT",
   BLOCKED_WORK_ITEM_COUNT = "BLOCKED_WORK_ITEM_COUNT",
-  EPIC_WORK_ITEM_COUNT = "EPIC_WORK_ITEM_COUNT",
+  // Count of epics for the Epics Peek view (not count of work items).
+  EPIC_WORK_ITEM_COUNT = "EPIC_WORK_ITEM_COUNT",
 }

Finally, please confirm on the backend/data layer that requests using EPIC_WORK_ITEM_COUNT are mapped correctly (so they won’t 400 or fall back).

apps/web/core/components/analytics/work-items/modal/content.tsx (1)

76-77: LGTM: Pass-through of isEpic to CustomizedInsights

This is the right place to thread the flag. No functional concerns here.

apps/web/core/components/analytics/select/analytics-params.tsx (1)

46-49: Review comment not applicable: AnalyticsSelectParams is only used with isEpic passed

Our grep across the repository shows a single JSX usage of <AnalyticsSelectParams …> in
apps/web/core/components/analytics/work-items/customized-insights.tsx, and that call site always supplies the isEpic boolean prop. No other components invoke AnalyticsSelectParams without isEpic.

Since every consumer currently passes a defined boolean for isEpic, there is no risk of “Estimate” or the epic axis being unintentionally hidden in other contexts. You can safely ignore the suggested guard around hiddenOptions.

Likely an incorrect or invalid review comment.

apps/web/core/components/analytics/work-items/customized-insights.tsx (2)

18-20: Nice: context-aware default of y_axis

Defaulting to EPIC_WORK_ITEM_COUNT when isEpic is true aligns with the PR’s goal of showing the correct epic label/metric on the Y-axis.


40-41: Prop passthrough looks correct

Forwarding isEpic to AnalyticsSelectParams ensures its hidden-options logic can filter the incompatible Y-axis metric.

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.

3 participants