cahilfoley/react-snowfall

Loading images from CDN doesn't show the images

Opened this issue · 1 comments

Using image urls from cdn like https://phljyzcntikuxhwretud.supabase.co/storage/v1/object/public/assets/flake1.png

but it doesn't seem to work, no images appear or the default circles.

I'm creating the document images inside useEffect and changing a state variable with the array values. Is this acceptable or does it need some other way? The example on the docs is not very "React-y"

I'll have to give this a test and have a look, but I suspect it's probably because the image hasn't been loaded by the time it's rendered to the offscreen canvas. This only happens once as an optimization so that might explain it.

Rather than creating the image elements in a useEffect I would recommend creating them with React and passing in a ref then using the ref to pass them into the config. I'll see if I can put together an example.