Solid Start does not load images on load event?
Why the load event does not work? I still get
true
after loading the image.8 Replies
Seems to work fine:
https://playground.solidjs.com/anonymous/06c22626-5476-4cb4-b75c-f9a3b826c236
I think you need to accomplish it with a single
<img />
element. Have the onLoad
change the src
once the placeholder is loaded. The browser will leave the placeholder in place until the real image is loaded.Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Ok thank you
does not work

It stays like that maybe that's ssr problem?
It does not even log the fired event.
I also use
workbox
to cache images
I also use workbox to cache imagesI wonder whether you're experiencing a race condition; given that the images are cached, perhaps they are loaded before the event handler is even added to the
<img />
element.
So you may need to delay setting the src
until it is certain that the handler is installed.
Try something like this:
https://playground.solidjs.com/anonymous/d0b41fd4-e7cb-4969-b1ed-0cace34cf620
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
i used this freaky solution wich seems to work for me
It does not swap the placeholder image in this case and idk why
It seems like it should work but it doesn't