-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WEB-1887] chore: Optimistically update cycle and module distributions #5290
Conversation
Important Review skippedAuto reviews are limited to specific labels. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent changes enhance the application's state management and user interaction capabilities. Key updates include new methods for tracking and updating issue statistics across various contexts, improved tooltip rendering for better user experience, and the introduction of utility functions for managing distribution data. These modifications collectively aim to streamline functionality, bolster performance, and improve data integrity within the project management framework. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant Store
participant Backend
User->>App: Interacts with UI
App->>Store: Request data update
Store->>Store: Update local statistics
Store-->>App: Return updated data
App->>User: Display updated UI
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
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: 1
Outside diff range, codebase verification and nitpick comments (2)
web/core/store/issue/project/issue.store.ts (1)
83-83
: Add a TODO comment for future implementation.The method
updateParentStats
is currently empty. Adding a TODO comment will help track the need for its implementation.updateParentStats = () => {}; + // TODO: Implement the updateParentStats method
web/core/store/issue/profile/issue.store.ts (1)
95-95
: Add a TODO comment for future implementation.The method
updateParentStats
is currently empty. Adding a TODO comment will help track the need for its implementation.updateParentStats = () => {}; + // TODO: Implement the updateParentStats method
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- web/core/components/core/sidebar/progress-chart.tsx (1 hunks)
- web/core/constants/state.ts (1 hunks)
- web/core/store/cycle.store.ts (3 hunks)
- web/core/store/estimates/project-estimate.store.ts (3 hunks)
- web/core/store/issue/archived/issue.store.ts (1 hunks)
- web/core/store/issue/cycle/issue.store.ts (2 hunks)
- web/core/store/issue/draft/issue.store.ts (1 hunks)
- web/core/store/issue/helpers/base-issues.store.ts (13 hunks)
- web/core/store/issue/module/issue.store.ts (2 hunks)
- web/core/store/issue/profile/issue.store.ts (1 hunks)
- web/core/store/issue/project-views/issue.store.ts (1 hunks)
- web/core/store/issue/project/issue.store.ts (1 hunks)
- web/core/store/issue/workspace/issue.store.ts (1 hunks)
- web/core/store/module.store.ts (3 hunks)
- web/helpers/distribution-update.helper.ts (1 hunks)
Additional comments not posted (27)
web/core/constants/state.ts (2)
43-43
: LGTM!The
COMPLETED_STATE_GROUPS
constant is correctly defined and enhances the clarity of state groupings.
44-49
: LGTM!The
PENDING_STATE_GROUPS
constant is correctly defined and aggregates several state keys, enhancing the organization of state groupings.web/core/components/core/sidebar/progress-chart.tsx (1)
139-139
: LGTM!The conditional access pattern for
datum.slice.points
enhances the robustness of the tooltip rendering by preventing potential runtime errors.web/core/store/issue/project-views/issue.store.ts (2)
73-74
: Implement functionality forupdateParentStats
.The
updateParentStats
method is currently an empty placeholder. Ensure to implement the intended functionality or remove the method if it is not required.
73-73
: Implement functionality forfetchParentStats
.The
fetchParentStats
method is currently an empty async function. Ensure to implement the intended functionality or remove the method if it is not required.web/core/store/issue/draft/issue.store.ts (1)
74-75
: Implement functionality forupdateParentStats
.The
updateParentStats
method is currently an empty placeholder. Ensure to implement the intended functionality or remove the method if it is not required.web/core/store/issue/archived/issue.store.ts (1)
77-78
: Implement functionality forupdateParentStats
.The
updateParentStats
method is currently an empty placeholder. Ensure to implement the intended functionality or remove the method if it is not required.web/core/store/issue/module/issue.store.ts (1)
94-112
: LGTM!The method
updateParentStats
is correctly implemented and aligns with the class structure.web/core/store/estimates/project-estimate.store.ts (2)
29-29
: LGTM!The addition of
currentActiveEstimate
as an optional property in theIProjectEstimateStore
interface enhances state management by allowing direct tracking of the currently active estimate.
65-65
: LGTM!The computed property
currentActiveEstimate
in theProjectEstimateStore
class correctly retrieves the current active estimate based on the project's ID. This enhances the functionality by providing direct access to the active estimate related to a specific project.Also applies to: 90-102
web/helpers/distribution-update.helper.ts (5)
71-102
: LGTM!The function
getDistributionPathsPostUpdate
correctly computes distribution updates by considering the previous and next issue states, as well as the current state map and project estimate. The logic for handling completed status and chart updates is sound.
112-153
: LGTM!The function
getDistributionDataOfIssue
correctly computes distribution data for a single issue state. It handles the case where the issue does not exist and computes path updates, assignee updates, label updates, and chart updates based on the issue state.
163-187
: LGTM!The function
getObjectDistributionArray
correctly computes distribution updates for assignees and labels by iterating over each ID and computing updates based on the issue state.
197-223
: LGTM!The function
getChartUpdates
correctly computes chart distribution updates based on the issue's completion state and estimate points. It handles the case where the completion date does not exist appropriately.
230-281
: LGTM!The function
updateDistribution
correctly updates the distribution of either cycle or module object by iterating over path updates, assignee updates, and label updates to apply changes to the distribution object.web/core/store/issue/cycle/issue.store.ts (2)
22-22
: LGTM!The import statement correctly includes the new helper function
getDistributionPathsPostUpdate
.
144-155
: LGTM!The method
updateParentStats
correctly computes distribution updates based on the previous and next issue states and updates the cycle distribution ifcycleId
is defined. This enhances the dynamic handling of issue state changes.web/core/store/module.store.ts (1)
324-338
: LGTM! Ensure correct usage ofupdateDistribution
.The code changes are approved.
However, verify that the
updateDistribution
function is used correctly. Ensure it updates the module's statistics as expected.Verification successful
LGTM! Ensure correct usage of
updateDistribution
.The code changes are approved. The
updateDistribution
function is correctly used to update module statistics locally.
web/core/store/module.store.ts
: Usage ofupdateDistribution
is correct.web/helpers/distribution-update.helper.ts
: The function is defined to handle updates appropriately.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct usage of the `updateDistribution` function. # Test: Search for the `updateDistribution` function usage. Expect: Correct usage in the context of updating module statistics. rg --type python -A 5 $'updateDistribution'Length of output: 73
Script:
#!/bin/bash # Description: Verify the correct usage of the `updateDistribution` function in TypeScript files. # Test: Search for the `updateDistribution` function usage. Expect: Correct usage in the context of updating module statistics. rg --type typescript -A 5 'updateDistribution'Length of output: 81
Script:
#!/bin/bash # Description: Verify the correct usage of the `updateDistribution` function in TypeScript files. # Test: Search for the `updateDistribution` function usage. Expect: Correct usage in the context of updating module statistics. rg --type ts -A 5 'updateDistribution'Length of output: 2331
web/core/store/cycle.store.ts (1)
490-504
: LGTM! Ensure correct usage ofupdateDistribution
.The code changes are approved.
However, verify that the
updateDistribution
function is used correctly. Ensure it updates the cycle's statistics as expected.Verification successful
LGTM! Ensure correct usage of
updateDistribution
.The code changes are approved. The
updateDistribution
function is used correctly within theupdateCycleDistribution
method to update the cycle's statistics.
web/helpers/distribution-update.helper.ts
: Definition ofupdateDistribution
web/core/store/cycle.store.ts
: Usage ofupdateDistribution
inupdateCycleDistribution
web/core/store/module.store.ts
: Similar usage ofupdateDistribution
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct usage of the `updateDistribution` function. # Test: Search for the `updateDistribution` function usage. Expect: Correct usage in the context of updating cycle statistics. rg --type python -A 5 $'updateDistribution'Length of output: 73
Script:
#!/bin/bash # Description: Verify the correct usage of the `updateDistribution` function. # Test: Search for the `updateDistribution` function definition and usage in TypeScript files. rg --type typescript -A 5 'updateDistribution'Length of output: 81
Script:
#!/bin/bash # Description: Verify the correct usage of the `updateDistribution` function. # Test: Search for the `updateDistribution` function definition and usage in TypeScript files. rg --type ts -A 5 'updateDistribution'Length of output: 2331
web/core/store/issue/helpers/base-issues.store.ts (8)
894-898
: LGTM! Verify the impact onremoveIssueFromCycle
behavior.The change ensures that parent stats are updated optimistically when an issue is removed from a cycle. Verify the impact on the method's behavior.
Verification successful
LGTM! Verify the impact on
removeIssueFromCycle
behavior.The change ensures that parent stats are updated optimistically when an issue is removed from a cycle. The search results confirm that
removeIssueFromCycle
is invoked in various places and the updated code ensuresupdateParentStats
is called optimistically. This aligns with the intended behavior of the change.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change on `removeIssueFromCycle` behavior. # Test: Search for calls to `removeIssueFromCycle` and ensure `updateParentStats` is invoked correctly. rg --type typescript -A 5 $'removeIssueFromCycle'Length of output: 83
Script:
#!/bin/bash # Description: Verify the impact of the change on `removeIssueFromCycle` behavior. # Test: Search for calls to `removeIssueFromCycle` and ensure `updateParentStats` is invoked correctly. rg --type-add 'ts:*.ts' -A 5 'removeIssueFromCycle'Length of output: 11388
676-680
: LGTM! Verify the impact onissueArchive
behavior.The change ensures that parent stats are updated optimistically when an issue is archived. Verify the impact on the method's behavior.
Verification successful
LGTM! Verify the impact on
issueArchive
behavior.The change ensures that parent stats are updated optimistically when an issue is archived. The impact on the method's behavior has been verified, and no issues were found.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change on `issueArchive` behavior. # Test: Search for calls to `issueArchive` and ensure `updateParentStats` is invoked correctly. rg --type typescript -A 5 $'issueArchive'Length of output: 75
Script:
#!/bin/bash # Description: Verify the impact of the change on `issueArchive` behavior. # Test: Search for calls to `issueArchive` and ensure `updateParentStats` is invoked correctly. rg 'issueArchive' --glob '*.ts' -A 5Length of output: 7240
562-567
: LGTM! Verify the impact onissueUpdate
behavior.The change ensures that parent stats are updated optimistically before making the API call. Verify the impact on the method's behavior.
Verification successful
LGTM! Verify the impact on
issueUpdate
behavior.The change ensures that parent stats are updated optimistically before making the API call. The
updateParentStats
method is invoked correctly within theissueUpdate
method.
web/core/store/issue/helpers/base-issues.store.ts
: Lines around 562-567.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change on `issueUpdate` behavior. # Test: Search for calls to `issueUpdate` and ensure `updateParentStats` is invoked correctly. rg --type typescript -A 5 $'issueUpdate'Length of output: 74
Script:
#!/bin/bash # Description: Verify the impact of the change on `issueUpdate` behavior. # Test: Search for calls to `issueUpdate` in TypeScript files and ensure `updateParentStats` is invoked correctly. rg 'issueUpdate' --glob '*.ts' -A 10Length of output: 20024
644-649
: LGTM! Verify the impact onremoveIssue
behavior.The change ensures that parent stats are updated optimistically when an issue is removed. Verify the impact on the method's behavior.
Verification successful
LGTM! Verify the impact on
removeIssue
behavior.The change ensures that parent stats are updated optimistically when an issue is removed. The
updateParentStats
method is invoked correctly within theremoveIssue
method, confirming the intended behavior.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change on `removeIssue` behavior. # Test: Search for calls to `removeIssue` and ensure `updateParentStats` is invoked correctly. rg --type typescript -A 5 $'removeIssue'Length of output: 74
Script:
#!/bin/bash # Description: Verify the impact of the change on `removeIssue` behavior. # Test: Search for calls to `removeIssue` and ensure `updateParentStats` is invoked correctly. rg --type ts -A 5 $'removeIssue'Length of output: 70776
Script:
#!/bin/bash # Description: Verify the invocation of `updateParentStats` within the `removeIssue` method. # Test: Search for the implementation of `updateParentStats` and check its usage within `removeIssue`. rg --type ts -A 5 $'updateParentStats'Length of output: 8056
1170-1176
: LGTM! Verify the impact onchangeModulesInIssue
behavior.The change ensures that parent stats are updated optimistically when modules are changed in an issue. Verify the impact on the method's behavior.
Verification successful
LGTM! The change ensures that parent stats are updated optimistically when modules are changed in an issue. The implementation of
changeModulesInIssue
correctly invokesupdateParentStats
, confirming the intended behavior.
changeModulesInIssue
method implementation inweb/core/store/issue/helpers/base-issues.store.ts
correctly callsupdateParentStats
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change on `changeModulesInIssue` behavior. # Test: Search for calls to `changeModulesInIssue` and ensure `updateParentStats` is invoked correctly. rg --type typescript -A 5 $'changeModulesInIssue'Length of output: 83
Script:
#!/bin/bash # Description: Verify the impact of the change on `changeModulesInIssue` behavior. # Test: Search for calls to `changeModulesInIssue` and ensure `updateParentStats` is invoked correctly. rg 'changeModulesInIssue' --glob '*.ts' -A 5Length of output: 6324
Script:
#!/bin/bash # Description: Extract the implementation of `changeModulesInIssue` and check for calls to `updateParentStats`. # Extract the implementation of `changeModulesInIssue` from `web/core/store/issue/helpers/base-issues.store.ts` rg 'changeModulesInIssue' -A 50 web/core/store/issue/helpers/base-issues.store.ts # Check for calls to `updateParentStats` in the same file rg 'updateParentStats' web/core/store/issue/helpers/base-issues.store.tsLength of output: 8015
528-528
: LGTM! Verify the impact oncreateIssue
behavior.The change ensures that parent stats are updated when a new issue is created if
shouldUpdateList
is true. Verify the impact on the method's behavior.Verification successful
LGTM! Verify the impact on
createIssue
behavior.The change ensures that parent stats are updated when a new issue is created if
shouldUpdateList
is true. The verification confirms thatfetchParentStats
is correctly invoked within thecreateIssue
method.
web/core/store/issue/helpers/base-issues.store.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change on `createIssue` behavior. # Test: Search for calls to `createIssue` and ensure `fetchParentStats` is invoked correctly. rg --type typescript -A 5 $'createIssue'Length of output: 74
Script:
#!/bin/bash # Description: Verify the impact of the change on `createIssue` behavior. # Test: Search for calls to `createIssue` and ensure `fetchParentStats` is invoked correctly. rg --type ts -A 5 $'createIssue'Length of output: 49804
Script:
#!/bin/bash # Description: Verify that `fetchParentStats` is invoked within the `createIssue` method in `base-issues.store.ts`. # Test: Search for `fetchParentStats` within the `createIssue` method. ast-grep --lang typescript --pattern $'class $_ { $$$ async createIssue($_, $_, $_, $_, $_) { $$$ shouldUpdateList && (await this.fetchParentStats($_, $_)); $$$ } $$$ }' -- web/core/store/issue/helpers/base-issues.store.tsLength of output: 243
Script:
#!/bin/bash # Description: Verify that `fetchParentStats` is invoked within the `base-issues.store.ts` file. # Test: Search for `fetchParentStats` invocation. rg 'fetchParentStats' web/core/store/issue/helpers/base-issues.store.ts -A 5Length of output: 4514
Line range hint
930-948
:
LGTM! Verify the impact onaddCycleToIssue
behavior.The change ensures that parent stats are updated optimistically when a cycle is added to an issue. Verify the impact on the method's behavior.
Verification successful
Change Verified: Impact on
addCycleToIssue
behavior is as expected.The
updateParentStats
method is correctly invoked within theaddCycleToIssue
method, ensuring that parent stats are updated optimistically. No issues were found with the implementation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the change on `addCycleToIssue` behavior. # Test: Search for calls to `addCycleToIssue` and ensure `updateParentStats` is invoked correctly. rg --type typescript -A 5 $'addCycleToIssue'Length of output: 78
Script:
#!/bin/bash # Description: Verify the impact of the change on `addCycleToIssue` behavior. # Locate TypeScript files and search for calls to `addCycleToIssue` to ensure `updateParentStats` is invoked correctly. fd -e ts -e tsx -x rg 'addCycleToIssue' {} -A 5Length of output: 6462
Script:
#!/bin/bash # Description: Verify the impact of the change on `addCycleToIssue` behavior by checking for `updateParentStats` calls. # Locate TypeScript files and search for `updateParentStats` within those files. fd -e ts -e tsx -x rg 'updateParentStats' {}Length of output: 1098
260-261
: Ensure implementation ofupdateParentStats
in derived classes.The new abstract method
updateParentStats
is essential for optimistically updating parent statistics. Ensure that all derived classes implement this method correctly.
@@ -76,6 +76,9 @@ export class WorkspaceIssues extends BaseIssuesStore implements IWorkspaceIssues | |||
|
|||
fetchParentStats = () => {}; | |||
|
|||
/** */ | |||
updateParentStats = () => {}; |
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.
Implement the updateParentStats
method.
The method updateParentStats
is defined but lacks an implementation. This suggests a potential enhancement to the class's functionality.
Do you need help implementing the updateParentStats
method or should I open a GitHub issue to track this task?
This PR updates the stats of cycles and modules optimistically with a front end logic without waiting for the server response.
Screen.Recording.2024-08-02.at.9.04.13.PM.mov
Summary by CodeRabbit
New Features
Bug Fixes
Chores