You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57
Current behavior
If an empty array [] is supplied to the show method of the <Messages /> component it will crash.
I have found the issue and the solution as well. The reason it is crashing is because newMessages within the show method is not assigned (only declared) which makes the value undefined. When the component then later tries to iterate this.state.messages its undefined which is why its crashing. Simply declaring it like this will solve the issue: let newMessages = [];
I will submit a PR for this.
Expected behavior
I expect it not to crash but instead not show any messages.
I'm submitting a ... (check one with "x")
Codesandbox Case (Bug Reports)
https://codesandbox.io/s/primereact-test-k2ut6
Current behavior
If an empty array
[]
is supplied to theshow
method of the<Messages />
component it will crash.I have found the issue and the solution as well. The reason it is crashing is because
newMessages
within theshow
method is not assigned (only declared) which makes the valueundefined
. When the component then later tries to iteratethis.state.messages
itsundefined
which is why its crashing. Simply declaring it like this will solve the issue:let newMessages = [];
I will submit a PR for this.
Expected behavior
I expect it not to crash but instead not show any messages.
Minimal reproduction of the problem with instructions
https://codesandbox.io/s/primereact-test-k2ut6
v3.0.0
Browser:
all
Language:
all
The text was updated successfully, but these errors were encountered: