Skip to content

Commit

Permalink
Fix primefaces#7483: Toast/Message handle remove by id 0
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Dec 6, 2024
1 parent 60e27a0 commit 43ac55c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/lib/messages/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const Messages = React.memo(

const remove = (messageInfo) => {
// allow removal by ID or by message equality
const removeMessage = messageInfo._pId ? messageInfo._pId : messageInfo.message || messageInfo;
const removeMessage = ObjectUtils.isNotEmpty(messageInfo._pId) ? messageInfo._pId : messageInfo.message || messageInfo;

setMessagesState((prev) => prev.filter((msg) => msg._pId !== messageInfo._pId && !ObjectUtils.deepEquals(msg.message, removeMessage)));

Expand Down
2 changes: 1 addition & 1 deletion components/lib/toast/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const Toast = React.memo(

const remove = (messageInfo) => {
// allow removal by ID or by message equality
const removeMessage = messageInfo._pId ? messageInfo._pId : messageInfo.message || messageInfo;
const removeMessage = ObjectUtils.isNotEmpty(messageInfo._pId) ? messageInfo._pId : messageInfo.message || messageInfo;

setMessagesState((prev) => prev.filter((msg) => msg._pId !== messageInfo._pId && !ObjectUtils.deepEquals(msg.message, removeMessage)));

Expand Down

0 comments on commit 43ac55c

Please sign in to comment.