Skip to content

Comments

[WEB-2598] fix: show toast when existing issue is added to cycles#5807

Merged
pushya22 merged 1 commit intopreviewfrom
fix/cycle-existing-issue-upload
Oct 17, 2024
Merged

[WEB-2598] fix: show toast when existing issue is added to cycles#5807
pushya22 merged 1 commit intopreviewfrom
fix/cycle-existing-issue-upload

Conversation

@sharma01ketan
Copy link
Contributor

@sharma01ketan sharma01ketan commented Oct 11, 2024

[WEB-2598]

This PR aims to display a toast message on the loading, success and failure state, when an existing issue is added to a cycle in the calendar view at the project level.

Previous State:

  • No successful toast is displayed when the promise is resolved
Screen.Recording.2024-10-08.at.3.34.30.PM.mov

New State:

  • Toast appears for: Uploading, Successful and Failure state, the Success state.
Screen.Recording.2024-10-08.at.3.34.51.PM.mov

Summary by CodeRabbit

  • New Features

    • Enhanced toast notifications for adding issues, providing clearer loading, success, and error feedback.
  • Bug Fixes

    • Improved error handling with dynamic messages for better user feedback during failures.

@sharma01ketan sharma01ketan added 🐛bug Something isn't working 🌐frontend labels Oct 11, 2024
@sharma01ketan sharma01ketan added this to the v0.24.0 milestone Oct 11, 2024
@sharma01ketan sharma01ketan self-assigned this Oct 11, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 11, 2024

Walkthrough

The changes introduced in the quick-add-issue-actions.tsx file primarily focus on updating the CalendarQuickAddIssueActions component. The import for the toast notification handling has been switched from setToast to setPromiseToast, enhancing the management of loading, success, and error states. The handleAddIssuesToView function has been refactored to improve error handling, providing dynamic messages based on errors encountered during asynchronous operations. Overall, these modifications aim to deliver a more informative user experience regarding issue updates.

Changes

File Change Summary
web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx Updated toast notification handling from setToast to setPromiseToast. Refactored handleAddIssuesToView for improved error handling with dynamic messages.

Possibly related PRs

Suggested labels

🎨UI / UX, ✨feature

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham

Poem

🐰 In the calendar's bright display,
Quick actions now lead the way.
With toasts that promise, clear and bright,
Errors handled, all feels right.
Hopping through updates, we cheer,
For a smoother path, oh so near! 🌼


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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 and nitpick comments (1)
web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx (1)

48-62: LGTM: Improved toast notifications with suggestion

The implementation of setPromiseToast with Promise.all is an excellent improvement. It addresses the PR objectives by providing clear feedback for loading, success, and error states when adding issues to cycles.

Suggestions for further improvement:

  1. Consider adding more specific error messages for common error types to provide clearer feedback to users.
  2. You might want to add a check for issueIds.length === 0 to handle cases where no issues are selected.

Here's a suggested enhancement for error handling:

setPromiseToast(addExistingIssuesPromise, {
  // ... (keep existing loading and success handlers)
  error: {
    title: "Error!",
    message: (err) => {
      if (err instanceof NetworkError) return "Network error. Please check your connection and try again.";
      if (err instanceof ValidationError) return "Invalid data. Please check your input and try again.";
      return err?.message || "Something went wrong. Please try again.";
    },
  },
});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 74695e5 and 7f7ffea.

📒 Files selected for processing (1)
  • web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx (3 hunks)
🧰 Additional context used
🔇 Additional comments (3)
web/core/components/issues/issue-layouts/calendar/quick-add-issue-actions.tsx (3)

11-11: LGTM: Import change aligns with PR objectives

The switch from setToast to setPromiseToast is a good improvement. This change aligns well with the PR's objective of implementing toast messages for different states (loading, success, failure) when adding an existing issue to cycles.


132-132: LGTM: Component now uses MobX observer, clarification needed

The addition of the observer HOC from mobx-react is a good change that will make the component reactive to changes in MobX observables. This could potentially improve performance and reactivity.

However, this change wasn't mentioned in the PR objectives. Could you please clarify the reasoning behind this addition? It would be helpful to understand how this fits into the overall goal of the PR or if it's addressing a separate concern.


Line range hint 1-132: Summary: Changes align well with PR objectives

The modifications in this file successfully address the main objective of the PR, which is to implement toast messages for different states when adding existing issues to cycles. The key improvements include:

  1. Switching to setPromiseToast for better handling of asynchronous operations.
  2. Implementing dynamic toast messages for loading, success, and error states.
  3. Enhancing error handling with more informative messages.

These changes will significantly improve the user experience by providing clear and immediate feedback on their actions.

The addition of the MobX observer HOC, while not directly related to the PR objectives, could potentially enhance the component's performance and reactivity. However, it would be beneficial to have more context on this change.

Overall, the implementation is solid and meets the PR's goals. Great job on improving the user feedback system!

@pushya22 pushya22 merged commit 9530884 into preview Oct 17, 2024
@pushya22 pushya22 deleted the fix/cycle-existing-issue-upload branch October 17, 2024 11:38
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.

3 participants