Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/components/mui/SnackbarNotification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,21 @@ const SnackbarNotification = ({
const messageContext = useMemo(() => ({ successMessage, errorMessage }), []);

const clearMessage = () => {
setMsgData({});
clearSnackbarMessage();
setMsgData({});
};

const onClose = () => {
setOpen(false);
setTimeout(clearMessage, NOTIFICATION_TIMEOUT);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@priscila-moneo could u explain the rationale of this on the PR description ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@smarcet updated!

};

const handleExited = () => {
clearMessage();
};

useEffect(() => {
if (!empty(msgData.html)) {
setOpen(true);
} else {
setOpen(false);
}
}, [msgData]);

Expand All @@ -71,6 +72,7 @@ const SnackbarNotification = ({
<Snackbar
open={open}
onClose={onClose}
onExited={handleExited}
anchorOrigin={{ vertical: "top", horizontal: "center" }}
autoHideDuration={NOTIFICATION_TIMEOUT}
>
Expand Down
Loading