-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
style: shorthand missing reactivity in prod mode #7386
Labels
Comments
My guess is that we need to enhance the following condition to also bail when a style attribute is used:
|
tivac
added a commit
to tivac/svelte
that referenced
this issue
Mar 24, 2022
Also a minor variable rename because it bugged me.
tivac
added a commit
to tivac/svelte
that referenced
this issue
Mar 24, 2022
Conduitry
pushed a commit
that referenced
this issue
Mar 30, 2022
This should be fixed in 3.46.5 - https://svelte.dev/repl/3f698e2bd883418d9561b44277df585c?version=3.46.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The
style:<prop>
orstyle:<prop>={prop}
shorthands can lose reactivity in prod mode in some cases. The particular use-case I'm seeing is a structure like thiswhere the inner
<div>
has no dynamic content, so in production mode the.innerHTML
optimization is applied. This then generates anoop
update function for the component.Adding dynamic content to the inner
<div>
will disable the.innerHTML
optimization and restore reactivity. Using the longhand style declaration likestyle="color: {color};"
will also work around this issue.Reproduction
https://svelte.dev/repl/3f698e2bd883418d9561b44277df585c?version=3.46.4
p
function in dev mode, see that reactivity existsdev
tofalse
p
function, it's now anoop
Important Note: the rendered output in the REPL seems to always use dev mode, so the result will look correct. You have to check the actual "JS output" tab to see the issue in the source.
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: