Skip to content

[WEB-2121] fix: project issue creation#5266

Merged
SatishGandham merged 2 commits intopreviewfrom
fix/project-issue-creation
Jul 31, 2024
Merged

[WEB-2121] fix: project issue creation#5266
SatishGandham merged 2 commits intopreviewfrom
fix/project-issue-creation

Conversation

@gakshita
Copy link
Collaborator

@gakshita gakshita commented Jul 30, 2024

Summary
On adding a new issue to a project different from the current project, the issue was getting reflected in the wrong project.

[WEB-2121]

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced issue creation functionality with additional parameters for improved flexibility.
    • Control over issue list updates based on the user's current project context.
  • Bug Fixes

    • Improved logic to prevent unnecessary method calls, optimizing performance and state management.
  • Documentation

    • Updated method signatures to clarify the functionality and usage of newly added parameters.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 30, 2024

Walkthrough

The recent changes enhance the issue creation functionality within the project management system. Key updates include parameter renaming for clarity and the addition of new optional parameters to the createIssue method. The logic for adding issues and fetching statistics has been refined to depend on specific conditions, ensuring more efficient state management. These modifications improve both the readability and flexibility of the code, streamlining how issues are handled within the application.

Changes

Files Change Summary
web/core/hooks/use-issues-actions.tsx, web/core/store/issue/project/issue.store.ts Renamed projectId to issueProjectId for clarity in useProjectIssueActions. Expanded createIssue method to include optional parameters: id and shouldUpdateList.
web/core/store/issue/helpers/base-issues.store.ts Updated logic to conditionally call addIssue and fetchParentStats based on the shouldUpdateList flag, enhancing control flow and preventing unnecessary calls.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ProjectActions as Project Actions
    participant IssueStore as Issue Store

    User->>ProjectActions: createIssue(workspaceSlug, issueProjectId, data)
    ProjectActions->>IssueStore: addIssue(data) if shouldUpdateList
    alt shouldUpdateList is true
        IssueStore-->>ProjectActions: Issue added successfully
        ProjectActions->>IssueStore: fetchParentStats()
    else shouldUpdateList is false
        ProjectActions-->>User: Issue created, no updates made
    end
Loading

🐰 In the meadow where bunnies play,
New changes hop in, brightening the day!
With clearer names and options galore,
Issue creation’s never been more!
Let’s dance with joy, oh what a delight,
Code's now a garden, blooming so bright! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6bb534d and 4bc04c8.

Files selected for processing (3)
  • web/core/hooks/use-issues-actions.tsx (1 hunks)
  • web/core/store/issue/helpers/base-issues.store.ts (1 hunks)
  • web/core/store/issue/project/issue.store.ts (2 hunks)
Additional comments not posted (4)
web/core/store/issue/project/issue.store.ts (2)

1-10: Reformatting imports for consistency

The import statements have been reformatted for consistency and clarity. This change does not affect the logic or functionality of the code.


39-45: Enhancement: Updated createIssue method signature

The createIssue method's signature has been expanded to include two additional optional parameters: id and shouldUpdateList. This change enhances the method's functionality by allowing the caller to specify whether to update the issue list after creating a new issue, thereby improving the flexibility of the API.

web/core/hooks/use-issues-actions.tsx (1)

94-96: Parameter renaming and logic enhancement

The parameter projectId has been renamed to issueProjectId for clarity. Additionally, a new boolean argument has been added to the issues.createIssue method call. This argument evaluates whether issueProjectId is equal to projectId, which likely influences the behavior of the createIssue function in specific scenarios.

web/core/store/issue/helpers/base-issues.store.ts (1)

523-525: Conditional logic for addIssue and fetchParentStats

The addIssue and fetchParentStats methods are now called based on the shouldUpdateList flag. This change improves the control flow by preventing unnecessary method calls when shouldUpdateList is false.

@SatishGandham
Copy link
Contributor

Isn't this issue coming from adding the issue to the current project store irrespective of project id?
Won't handling it where we add the created issue to the store solve it better?

Copy link
Contributor

@rahulramesha rahulramesha left a comment

Choose a reason for hiding this comment

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

@gakshita, The logic of the changes look fine. But instead of modifying the createIssue in use-issues-actions, can you please consider writing it in this format inside issue.store for project.
Only reason to recommend it that way is to maintain commonality between methods and classes.


// add Issue to Store
this.addIssue(response, shouldUpdateList);
shouldUpdateList && this.addIssue(response, shouldUpdateList);
Copy link
Contributor

Choose a reason for hiding this comment

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

This Change is not required.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4bc04c8 and ceccdab.

Files selected for processing (1)
  • web/core/store/issue/project/issue.store.ts (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/core/store/issue/project/issue.store.ts

@SatishGandham SatishGandham merged commit dd3df20 into preview Jul 31, 2024
@SatishGandham SatishGandham deleted the fix/project-issue-creation branch July 31, 2024 08:43
@coderabbitai coderabbitai bot mentioned this pull request Oct 12, 2024
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.

3 participants