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
The usePageErrors hook correctly checks the result as an instance of a ResultRecord to pull out error messages and returns early. However, result can come from anywhere - in cases where it is an Error thrown, the array that we are returning as pageErrors is no longer a string array - it might be a [Error, string] or objects of any other shape. This can cause issues when mapping out what consumers expect to be an array of plain strings to JSX.
Example of React error in development when an Error is thrown and caught by handlePageLoadError, then mapped in an unordered list
Add a safe guard to check for a string or otherwise try to coalesce the object into a string:
The
usePageErrors
hook correctly checks theresult
as an instance of aResultRecord
to pull out error messages and returns early. However,result
can come from anywhere - in cases where it is anError
thrown, the array that we are returning aspageErrors
is no longer a string array - it might be a[Error, string]
or objects of any other shape. This can cause issues when mapping out what consumers expect to be an array of plain strings to JSX.Example of React error in development when an Error is thrown and caught by handlePageLoadError, then mapped in an unordered list
Add a safe guard to check for a string or otherwise try to coalesce the object into a string:
The text was updated successfully, but these errors were encountered: