We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Using bind:this and a writable store together doesn't provide expected behavior.
bind:this
Logs No error log.
To Reproduce Can be reproduced in REPL:
<script> import { writable } from 'svelte/store' let ref = writable(null) </script> <h1 bind:this={$ref}>HELLO</h1> <i>{$ref ? $ref.innerHTML : ''}</i>
Expected behavior Expect to see two lines of "HELLO". The second "HELLO" inside <i> didn't show up as expected.
<i>
Severity Can be worked around.
Work around
<script> import { writable } from 'svelte/store' let ref = writable({}) </script> <h1 bind:this={$ref.el}>HELLO</h1> <i>{$ref.el ? $ref.el.innerHTML : ''}</i>
The text was updated successfully, but these errors were encountered:
This looks to be fixed by
diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index ee24fc70..042a755f 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -777,7 +777,7 @@ export default class Component { } if (name[0] === '$' && name[1] !== '$') { - return x`${name.slice(1)}.set(${name})`; + return x`${name.slice(1)}.set(${value || name})`; } if (
but I'm now wondering what else with stores might be fixed by this, as this change isn't specific to bind:this at all.
Sorry, something went wrong.
fix invalidating store to specific value (sveltejs#3591)
1689f96
fix bind:this binding to a store (#3591)
8d7d0ff
Successfully merging a pull request may close this issue.
Describe the bug
Using
bind:this
and a writable store together doesn't provide expected behavior.Logs
No error log.
To Reproduce
Can be reproduced in REPL:
Expected behavior
Expect to see two lines of "HELLO". The second "HELLO" inside
<i>
didn't show up as expected.Severity
Can be worked around.
Work around
The text was updated successfully, but these errors were encountered: