Skip to content
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

feat:[M3-8330] - Improve API flexibility for useToastNotification #10654

Merged
merged 5 commits into from
Jul 9, 2024

Conversation

jaalah-akamai
Copy link
Contributor

@jaalah-akamai jaalah-akamai commented Jul 8, 2024

Description 📝

We need to enhance the API of this hook to increase its flexibility in handling event notifications. For example, we have a new event, tax_id_invalid. When this event is successful (indicating the tax ID is invalid), we want to display the error variant and ensure the notification persists. Currently, there's no way to easily inverse the toast variant depending on the event.

Changes 🔄

  • Renamed persistFailureMessage to persist
  • Added tax_id_invalid event which is feature flagged
  • Added an invertVariant property to handle scenarios where a successful negative event should be represented as an error variant.
  • Added new interface:
interface ToastMessage {
  link?: JSX.Element;
  message: ((event: Event) => string | undefined) | string;
  persist?: boolean;
}

Target release date 🗓️

7/22

How to test 🧪

Verification steps

(How to verify changes)

  • Trigger any of the events listed in the hook
  • Example: Create a volume and observe the multiple toasts that appear
  • Manually add these properties to volume_create:
invertVariant: true,
persist: 'success',
  • Observe the success should now be an error toast and it should be persisted.

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@jaalah-akamai jaalah-akamai self-assigned this Jul 8, 2024
@jaalah-akamai jaalah-akamai requested a review from a team as a code owner July 8, 2024 19:56
@jaalah-akamai jaalah-akamai requested review from jdamore-linode and abailly-akamai and removed request for a team July 8, 2024 19:56
Copy link

github-actions bot commented Jul 8, 2024

Coverage Report:
Base Coverage: 82.23%
Current Coverage: 82.26%

@jaalah-akamai
Copy link
Contributor Author

@bnussman-akamai Good suggestions - let me know if there's anything else

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change makes sense! Confirming the toast status inversion ✅

will take this into consideration when getting to this refactor for the Events V2 epic

)}
{link && <>&nbsp;{link}</>}
</>
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWI this isn't going to remain as such when I get to this part of the event refactor. We are going to use event factories to display these messages to it's centralized and consistent.

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Ready for Review labels Jul 9, 2024
@jaalah-akamai jaalah-akamai merged commit 395434f into linode:develop Jul 9, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants