Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srcset hydration results in expensive DOM updates #8838

Closed
benmccann opened this issue Jun 24, 2023 · 0 comments · Fixed by #8868
Closed

srcset hydration results in expensive DOM updates #8838

benmccann opened this issue Jun 24, 2023 · 0 comments · Fixed by #8868
Labels
compiler Changes relating to the compiler perf

Comments

@benmccann
Copy link
Member

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Changes relating to the compiler perf
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant