[WEB-3863] fix: handled error handling for link editing#6968
[WEB-3863] fix: handled error handling for link editing#6968sriramveeraghanta merged 1 commit intopreviewfrom
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LinkStore
participant RemoteService
User->>LinkStore: updateLink(linkId, update)
LinkStore->>LinkStore: Save initialData (shallow copy)
LinkStore->>LinkStore: Optimistically update linkMap
alt Remote update succeeds
LinkStore->>RemoteService: updateLink(linkId, update)
RemoteService-->>LinkStore: Success response
LinkStore->>LinkStore: Fetch activities
LinkStore-->>User: Return updated link
else Remote update fails
LinkStore->>RemoteService: updateLink(linkId, update)
RemoteService-->>LinkStore: Error
LinkStore->>LinkStore: Log error, revert linkMap to initialData
LinkStore-->>User: Return reverted data
end
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Pull Request Linked with Plane Work Items
Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
web/core/store/issue/issue-details/link.store.ts (1)
124-145: Good implementation of error handling with state reversion.The changes appropriately handle errors during link updates by:
- Creating a backup of the initial state
- Using try-catch to handle API failures
- Reverting to the initial state on error using MobX's runInAction
This prevents the UI from showing an inconsistent state when link updates fail.
One minor suggestion: Consider using a more structured error logging approach instead of
console.errorfor better production error tracking.- console.error("error", error); + // Replace with your app's error logging service + this.rootIssueDetailStore.logger?.error("Failed to update issue link", { error, linkId, issueId });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/core/store/issue/issue-details/link.store.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
Description
Handled false state updation for invalid links
References
[WEB-3863]
Summary by CodeRabbit