-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
Description
Describe the bug
Svelte always thinks the client side srcset
is different from the server side srcset
. For sites that make heavy use of picture
(e.g. via a generic Image
component like in sveltejs/kit#241 (comment) or sveltejs/kit#9787) this ends up being really expensive.
If /myimg.png
is SSR'd, the client-side URL contains the full URL including hostname, so Svelte thinks they don't match. There's special logic for this around an img
src
attribute, but srcset
was overlooked.
svelte/packages/svelte/src/compiler/compile/render_dom/wrappers/Element/Attribute.js
Line 164 in 7bab2d4
b`if (!@src_url_equal(${element.var}.src, ${init})) ${method}(${element.var}, "${name}", ${this.last});` |
Reproduction
Any picture
with a srcset
Logs
No response
System Info
Happens with 3.x and 4.0
Severity
annoyance