-
Notifications
You must be signed in to change notification settings - Fork 20
Force recreating the img element to show LQIP styles #1712
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
Conversation
🦋 Changeset detectedLatest commit: c97ca84 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
5410462 to
5dba5c7
Compare
|
@wkillerud completed the PR to cover all frameworks, if you want to give this another review! It's not looking quite beautiful in all cases, React and Ember needed some shenanigans, for the rest it was rather straightforward as they had explicit support for the concept of key/keyed, even for a single element. But it works everywhere it seems, without any manual DOM manipulation workarounds. Other use case for recreating DOM elements was mentioned btw: forcing new animations/transitions. See https://lit.dev/docs/templates/directives/#keyed and https://svelte.dev/docs/svelte/key. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work digging into all of these frameworks! 🎉 Looks good to me 👍



<img>element is reused across renders, when no LQIP is used. Otherwise DOM recreation is enforced to wipe out the state of the previously loaded image.Fixes #1583, in particular #1583 (comment).
Added a rerender test case where this was missing, and added assertions for DOM reuse (default) or DOM recreation (LQIP).