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

Fix Notification raises a MUI warning when message is a string #8666

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

slax57
Copy link
Contributor

@slax57 slax57 commented Feb 20, 2023

Fix #8664

Notes

Didn't add a test cause I'm not sure it would make sense to have a test ensuring MUI does not raise any warning (as it's pretty specific). But I can add one if you guys think otherwise.

The fix can be tested with the Basic story of the Notification storybook.

@slax57 slax57 added the RFR Ready For Review label Feb 20, 2023
@djhi djhi added this to the 4.8.1 milestone Feb 20, 2023
@djhi djhi merged commit 390b3eb into master Feb 20, 2023
@djhi djhi deleted the fix-snackbar-mui-warning branch February 20, 2023 09:44
@magnattic
Copy link

Thank you! This helps us a lot. Minor nitpick, the title of the PR should probably be

Fix Notification raises a MUI warning when message is NOT a string

right?

@slax57
Copy link
Contributor Author

slax57 commented Feb 20, 2023

@magnattic No, it's the other way around. When message is not a string, it is a React Element, and in this case the Snackbar throws no error because it is supported.
When message is a string, then instead of passing no child to Snackbar we passed false, which caused the warning.
So the fix actually applies when message IS a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed prop type: Invalid prop children of type boolean supplied to ForwardRef(Snackbar)
3 participants