Skip to content

[WEB-1812] fix : Avoid loader when parent is added in issue detail / peek overview#5257

Merged
SatishGandham merged 3 commits intopreviewfrom
fix-parent-select-refresh
Jul 30, 2024
Merged

[WEB-1812] fix : Avoid loader when parent is added in issue detail / peek overview#5257
SatishGandham merged 3 commits intopreviewfrom
fix-parent-select-refresh

Conversation

@rahulramesha
Copy link
Contributor

@rahulramesha rahulramesha commented Jul 29, 2024

This PR fixes the loader which appears when parent issue is added to the Issue

Screen.Recording.2024-07-29.at.7.02.28.PM.mov

Summary by CodeRabbit

  • New Features

    • Enhanced fetching functionality for issue operations with optional loader parameter, improving user experience.
    • Updated IssuePeekOverview component to better manage issue handling operations, consolidating operation types for improved usability.
  • Bug Fixes

    • Fixed sub-issues count not updating correctly in parent issue details, ensuring accurate representation of sub-issues.

@rahulramesha rahulramesha added 🐛bug Something isn't working 🌐frontend labels Jul 29, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 29, 2024

Walkthrough

The changes enhance the functionality and flexibility of issue management within the application. Key updates include modifications to the fetch method of TIssueOperations to include a loader parameter, adjustments to how parent issues are handled in the IssueParentSelect component, and improvements in state management for sub-issues in the IssueSubIssuesStore. Overall, these updates aim to improve user experience and maintainability of the codebase.

Changes

Files Change Summary
.../issue-detail/parent-select.tsx Modified handleParentIssue function to include a boolean parameter in the issueOperations.fetch call, allowing for more explicit control over data fetching behavior.
.../issue-detail/root.tsx Updated TIssueOperations type by adding an optional loader parameter to the fetch method, enhancing its functionality by allowing callers to control loader visibility during fetching.
.../peek-overview/root.tsx Removed TIssuePeekOperations type, replacing it with TIssueOperations. Updated issueOperations.fetch method to include an optional loader parameter, defaulting to true, improving flexibility in managing loader state during fetching.
.../issue-details/sub_issues.store.ts Introduced a new conditional block in IssueSubIssuesStore to update the sub_issues_count of a parent issue whenever subIssues are retrieved, enhancing state management for issues.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant IssueParentSelect
    participant IssueOperations
    participant IssueSubIssuesStore

    User->>IssueParentSelect: Select Parent Issue
    IssueParentSelect->>IssueOperations: fetch(issueId, false)
    IssueOperations-->>IssueParentSelect: Return Issue Data
    IssueParentSelect->>User: Display Parent Issue

    User->>IssueSubIssuesStore: Fetch Sub-Issues
    IssueSubIssuesStore->>IssueOperations: fetch(parentIssueId, true)
    IssueOperations-->>IssueSubIssuesStore: Return Sub-Issues
    IssueSubIssuesStore->>IssueSubIssuesStore: Update sub_issues_count
Loading

Poem

🐇 In the garden of code, changes bloom bright,
New fetches with loaders bring user delight.
With sub-issues counted, and parents in view,
Our software hops forward, refreshed and anew!
So let’s celebrate progress, with code that’s in tune,
For every small change makes the whole system bloom! 🌼


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

Outside diff range, codebase verification and nitpick comments (1)
web/core/components/issues/issue-detail/root.tsx (1)

Line range hint 62-65:
Integrate the loader parameter into the fetch method implementation.

The fetch method in the issueOperations object does not currently utilize the loader parameter. Consider integrating it to ensure the parameter is functional.

- fetch: async (workspaceSlug: string, projectId: string, issueId: string) => {
+ fetch: async (workspaceSlug: string, projectId: string, issueId: string, loader?: boolean) => {
    try {
+     if (loader) {
+       // Show loader
+     }
      await fetchIssue(workspaceSlug, projectId, issueId);
+     if (loader) {
+       // Hide loader
+     }
    } catch (error) {
      console.error("Error fetching the parent issue");
+     if (loader) {
+       // Hide loader
+     }
    }
  }
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 35e58e9 and ae64023.

Files selected for processing (4)
  • web/core/components/issues/issue-detail/parent-select.tsx (1 hunks)
  • web/core/components/issues/issue-detail/root.tsx (1 hunks)
  • web/core/components/issues/peek-overview/root.tsx (3 hunks)
  • web/core/store/issue/issue-details/sub_issues.store.ts (1 hunks)
Additional comments not posted (6)
web/core/components/issues/issue-detail/parent-select.tsx (1)

51-51: Verify the impact of the additional parameter in the fetch method.

The additional boolean parameter set to false in the issueOperations.fetch method aims to control the loader state explicitly. Ensure that this change does not introduce any unintended side effects.

web/core/components/issues/peek-overview/root.tsx (3)

9-9: Verify the correctness of the import statement.

The import statement has been updated to include TIssueOperations. Ensure that this import is correctly implemented and used throughout the file.

Verification successful

Verify the correctness of the import statement.

The import statement has been updated to include TIssueOperations. Ensure that this import is correctly implemented and used throughout the file.


The import statement is correctly implemented and used.

The TIssueOperations type is imported and utilized within the file web/core/components/issues/peek-overview/root.tsx.

  • web/core/components/issues/peek-overview/root.tsx: TIssueOperations is used in a useMemo hook.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the import statement.

# Test: Search for the usage of `TIssueOperations` in the file to ensure it is correctly implemented.
rg --type typescript -A 5 $'TIssueOperations'

Length of output: 79


Script:

#!/bin/bash
# Description: Verify the correctness of the import statement.

# Test: Search for the usage of `TIssueOperations` in the specified file to ensure it is correctly implemented.
rg 'TIssueOperations' web/core/components/issues/peek-overview/root.tsx

Length of output: 191


46-46: Verify the impact of the removal of TIssuePeekOperations.

The TIssuePeekOperations type has been removed entirely. Ensure that this removal does not introduce any issues or breaking changes.

Verification successful

The removal of TIssuePeekOperations does not introduce any issues or breaking changes.

The search confirmed that TIssuePeekOperations is no longer used in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the impact of the removal of `TIssuePeekOperations`.

# Test: Search for the usage of `TIssuePeekOperations` in the codebase to ensure it is no longer used.
rg --type typescript -A 5 $'TIssuePeekOperations'

Length of output: 83


Script:

#!/bin/bash
# Description: Verify the impact of the removal of `TIssuePeekOperations`.

# Test: Search for the usage of `TIssuePeekOperations` in the codebase to ensure it is no longer used.
rg --type ts -A 5 'TIssuePeekOperations'

Length of output: 40


48-50: Verify the impact of the additional parameter in the fetch method.

The fetch method within the issueOperations object has been modified to include an additional parameter, loader, defaulting to true. Ensure that this change does not introduce any unintended side effects.

web/core/store/issue/issue-details/sub_issues.store.ts (1)

131-135: Verify the correctness of the new conditional block.

The new conditional block updates the sub_issues_count of a parent issue when subIssues is present. Ensure that this change accurately reflects the count of sub-issues and does not introduce any unintended side effects.

Verification successful

The new conditional block is correctly implemented.

The sub_issues_count is accurately updated in various parts of the codebase, and the updateIssue method is consistently used. This ensures that the count of sub-issues is correctly reflected in the parent issue's details without introducing any unintended side effects.

  • sub_issues_count is used in multiple files, confirming its integration.
  • updateIssue method is correctly implemented and widely used.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new conditional block.

# Test: Search for the usage of `sub_issues_count` in the codebase to ensure it is correctly updated.
rg --type typescript -A 5 $'sub_issues_count'

Length of output: 79


Script:

#!/bin/bash
# Description: Verify the correctness of the new conditional block.

# Test: Search for the usage of `sub_issues_count` in the codebase to ensure it is correctly updated.
rg --type ts -A 5 'sub_issues_count'

# Test: Search for the implementation and usage of `updateIssue` to ensure it is correctly called.
rg --type ts -A 5 'updateIssue'

Length of output: 144054

web/core/components/issues/issue-detail/root.tsx (1)

27-27: The addition of the optional loader parameter is correct.

The change to the fetch method in the TIssueOperations type definition looks good and enhances the method's functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working 🌐frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants