mbrevda / react-image

React.js <img> tag rendering with multiple fallback & loader support
MIT License
1.2k stars 88 forks source link

Error [object Event] When no image is found at the src provided #991

Closed rlkeyer closed 1 year ago

rlkeyer commented 1 year ago

Hi,

I noticed when I began using useImage instead of the legacy component I am getting an error when the src provided does not find a valid image. I saw this referenced before here: https://github.com/mbrevda/react-image/issues/651. Is there a way to still use suspense but avoid this issue? I created this codesandbox as an example: https://codesandbox.io/s/misty-sky-jt148n?file=/src/App.js

mbrevda commented 1 year ago

This codesandbox is deceiving. If you switch the ErrorBoundrys fallback prop to <span>error</span> and close the errors overlay you'll see that the fallback error is actually displayed.

I'm not sure there is anything further react-image can do here, but open to ideas!