-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
onExited callback key mismatch caused by Material-UI #276
Comments
Hey @Gareon, I found your issue from noticing the same behaviour and it turns out that onExited actually has three arguments. There are still other things wrong with it, but you can fix any issues you're having with the key by doing |
This is bug caused by latest version of material-ui. meaning if you downgrade MUI core it'll start working: Alternatively and temporarily, as @actual-size said, you can access the key as the third argument. |
I'm going to open a PR in mui-core to fix this. Until then I'm keeping this open. |
If I understand the previous API was: enqueueSnackbar("Some message", {
key: "test",
variant: "default",
onEntered: (node, appearing, key) => {
console.info("exited with key=" + JSON.stringify(myKey));
},
onExited: (node, key) => {
console.info("exited with key=" + JSON.stringify(myKey));
}
}); Would it make sense to turn the API to an object? enqueueSnackbar("Some message", {
key: "test",
variant: "default",
onEntered: ({ node, appearing, key, variant }) => {
console.info("exited with key=" + JSON.stringify(myKey));
},
onExited: ({ node, key, variant }) => {
console.info("exited with key=" + JSON.stringify(myKey));
}
}); |
@oliviertassinari It'd make sense to pass Also did you intend to include |
@iamhosseindhv Definitely, I was wondering about the merit of the change for a future major. Regarding |
I agree @oliviertassinari. We have a similar situation in #259 were people need more options to be passed in the callback. Possibly a good feature to have an eye on. |
Closing this as my PR mui/material-ui#21158 is now merged. |
Expected Behavior
When enqueuing a snackbar providing a key as well as a callback for the
onExited
event, I expected thekey
given as the second callback argument when it gets fired.Current Behavior
The
onExited
event gets fired, but thekey
argument is alwaysundefined
.Steps to Reproduce
onExited
handler and inspect thekey
argument as soon as it gets fired:exited with key=undefined
You can reproduce / verify the problem by checking out the redux integration example on codesandbox.io.
Context
According to the documentation, I'm trying to integrate notistack with a redux state.
Your Environment
The text was updated successfully, but these errors were encountered: