-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[BUG] Success and Error notifications cannot return undefined
to fallback to default
#6270
Comments
Hey @PercivalFigaro can you try returning true as a fallback? |
Looks like there's an issue with the types here. When passing You can check if this works for you by adding |
@aliemir Yeah, returning undefined works nicely, but generates type errors not only in the notification related part of code, but also in another line in my project:
I can work around with |
@PercivalFigaro I've also noticed that when we use The fix should be simple as updating the function type of Here are the related lines: refine/packages/core/src/contexts/notification/types.ts Lines 11 to 30 in 4c34444
I'll update the issue title and description as bug. Please let us know if you can work on this one, we'll be happy to see your contribution 🚀 🚀 |
undefined
to fallback to default
@aliemir I would like to be assigned to this issue if it's still available. |
Hey @emrecancorapci, assigned issue to you. |
…ication` (#6327) (resolves #6270) Co-authored-by: Ali Emir Şen <[email protected]>
Update
This issue was initially opened up as a feature request and converted to a bug. The requested feature is possible with the current implementation but the types are not supporting returning
undefined
fromsuccessNotification
anderrorNotification
props of the hooks when passed as functions.Check out the comment #6270 (comment) about the issue and the fix.
Is your feature request related to a problem? Please describe.
If there are field validation errors from the server side, I want to hide the snackbar (by using a custom errorNotification and then simply not displaying it), but otherwise, display the default error notification snackbar. To do that, I currently need to recreate the default error manually (unless I'm mistaken).
Describe alternatives you've considered
There should be a way to 'passthrough' and use the default notification if my condition to use a custom errorNotification is not met
Additional context
No response
Describe the thing to improve
Instead of the code above, it should be possible to return the original error notification, like so:
The text was updated successfully, but these errors were encountered: