Skip to content

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Mar 28, 2025

Description

This PR includes following changes:

  • Work item store optimization and code refactoring

Type of Change

  • Bug fix
  • Code refactoring

References

[WEB-3704]

Summary by CodeRabbit

  • Refactor
    • Updated the sub-issue display to fetch detailed data based on the issue context for improved accuracy.
    • Streamlined issue details management, enhancing consistency in displaying related interactions such as attachments, comments, and activity.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 28, 2025

Walkthrough

Two areas of the code have been modified. The IssueList component now calls the useIssueDetail hook with the issueServiceType argument, affecting how sub-issue details are retrieved. In the issue store, a new variable (rootWorkItemDetailStore) is introduced to conditionally select between epic and regular issue details from the underlying store, reducing redundancy in the code.

Changes

File(s) changed Change Summary
web/core/components/issues/sub-issues/issues-list.tsx Updated the useIssueDetail hook invocation by adding the issueServiceType parameter to alter sub-issue data retrieval.
web/core/store/issue/issue-details/issue.store.ts Introduced a new variable (rootWorkItemDetailStore) that conditionally assigns either epicDetail or issueDetail to streamline handling of issue details.

Sequence Diagram(s)

sequenceDiagram
    participant IL as IssueList Component
    participant IH as useIssueDetail Hook
    IL->>IH: Call useIssueDetail(issueServiceType)
    IH-->>IL: Return subIssuesByIssueId
Loading
sequenceDiagram
    participant IS as Issue Store
    participant RIS as RootIssueStore
    IS->>RIS: Retrieve issue details
    alt Issue is Epic
        RIS-->>IS: Return epicDetail
    else Regular Issue
        RIS-->>IS: Return issueDetail
    end
    IS->>IS: Process issue reactions, links, attachments, etc.
Loading

Possibly related PRs

Suggested labels

🌟improvement, 🧹chore

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

In the code garden I hop with glee,
New parameters bloom for all to see,
A hook refined with a service type so neat,
And stores now sing with details complete,
A rabbit’s delight in every line, oh so sweet! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4933f0 and c49eefa.

📒 Files selected for processing (1)
  • web/core/store/issue/issue-details/issue.store.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/core/store/issue/issue-details/issue.store.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)

🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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 Mar 28, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8216785 and f4933f0.

📒 Files selected for processing (2)
  • web/core/components/issues/sub-issues/issues-list.tsx (1 hunks)
  • web/core/store/issue/issue-details/issue.store.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (3)
web/core/store/issue/issue-details/issue.store.ts (2)

304-306: Good refactoring to enhance code maintainability.

Creating the rootWorkItemDetailStore variable to conditionally select between epic and issue detail stores based on the issue type is a great improvement. This abstraction simplifies the code and makes it more maintainable by removing conditional logic duplication throughout the function.


342-352: Good application of the store abstraction for related data fetching.

The use of rootWorkItemDetailStore for fetching activities, comments, sub-issues, and relations is well implemented. This makes the code more consistent and easier to maintain as the conditional logic is isolated to a single place.

web/core/components/issues/sub-issues/issues-list.tsx (1)

43-43:

Details

✅ Verification successful

Updated hook call to support different issue service types.

The useIssueDetail hook call now includes the issueServiceType parameter, which allows the component to retrieve the correct sub-issue details based on the type of service (issues, epics, etc.). This change aligns well with the store refactoring in issue.store.ts.


🏁 Script executed:

#!/bin/bash
# Verify the implementation of useIssueDetail hook to ensure it properly handles the issueServiceType parameter

# Look for the useIssueDetail hook implementation
echo "Searching for useIssueDetail hook implementation..."
rg -A 10 "export const useIssueDetail" --type tsx --type ts

Length of output: 202


I'll now run a refined shell script that uses glob patterns for searching TypeScript and TSX files, since the previous command failed due to the unrecognized file type "tsx". This will help us verify the implementation of the useIssueDetail hook correctly.

Please run the above script to gather the necessary information for verification.


🏁 Script executed:

#!/bin/bash
echo "Searching for useIssueDetail hook implementation using glob patterns (*.ts, *.tsx)..."
rg -A 10 "export const useIssueDetail" -g "*.ts" -g "*.tsx"

Length of output: 1446


Verified: Hook usage and implementation are correct.

The updated call in web/core/components/issues/sub-issues/issues-list.tsx now correctly passes the issueServiceType parameter. The implementation in web/core/hooks/store/use-issue-detail.ts properly handles this parameter by returning context.issue.epicDetail when serviceType is EIssueServiceType.EPICS, and the default context.issue.issueDetail otherwise. This aligns well with the recent store refactoring in issue.store.ts.

No further changes are needed here.

@sriramveeraghanta sriramveeraghanta merged commit 921dfe3 into preview Mar 28, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-work-item-store branch March 28, 2025 13:08
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* chore: work item store optimization and code refactor

* chore: code refactor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants