-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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-1971] fix: remove issue from cycle while changing cycle #5246
Conversation
WalkthroughThe recent changes enhance the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant BaseIssuesStore
User->>BaseIssuesStore: addCycleToIssue(issueId, cycleId)
alt Check Existing Cycle
BaseIssuesStore-->>User: return (same cycle)
else Process Update
BaseIssuesStore->>BaseIssuesStore: update issueCycleId
BaseIssuesStore->>BaseIssuesStore: remove issueId from list if necessary
end
BaseIssuesStore-->>User: return updated state
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: 0
Outside diff range, codebase verification and nitpick comments (1)
web/core/store/issue/helpers/base-issues.store.ts (1)
895-895
: Add a comment to explain the purpose of this check.Adding a comment will help other developers understand why this early return is necessary.
+ // If the issue is already associated with the given cycleId, return early to avoid redundant operations. const issueCycleId = this.rootIssueStore.issues.getIssueById(issueId)?.cycle_id;
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- web/core/store/issue/helpers/base-issues.store.ts (1 hunks)
Additional comments not posted (2)
web/core/store/issue/helpers/base-issues.store.ts (2)
896-896
: Early return optimization looks good.The early return prevents unnecessary processing if the
cycleId
is already linked to the issue.
901-902
: Ensure state consistency when updating cycle ID.The state update logic correctly handles removing the issue from the list if the cycle ID before the update matches the current cycle ID.
try { | ||
// Update issueIds from current store | ||
runInAction(() => { | ||
// If cycle Id before update is the same as current cycle Id then, remove issueId from list | ||
if (this.cycleId === issueCycleId) this.removeIssueFromList(issueId); |
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.
Why are we removing the issue from the list? Is it like a toggle?
This PR fixes the issue when updating cycle while in a cycle issues page, the issue does not get removed.
Screen.Recording.2024-07-26.at.7.06.27.PM.mov
Summary by CodeRabbit
These enhancements lead to a more responsive and accurate issue management experience for users.