-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Describe the bug
This only happens in very specific circumstances, e.g. "binding" to a set-only property of a snippet argument.
The warning is not easy to understand in that context and will not happen with a regular property binding.
(The code behaves as expected so the warning feels like it might be a false positive.)
Reproduction
<script>
let elementFunBind = $state();
$inspect('fun', elementFunBind?.tagName);
let elementPropBind = $state();
$inspect('prop', elementPropBind?.tagName);
let elementEvent = $state();
$inspect('event', elementEvent?.tagName);
</script>
{#snippet funBind(context)}
<!-- only this triggers the warning: -->
<input value="via fun" bind:this={() => {}, e => context.element = e} />
{/snippet}
{@render funBind({ set element(e) { elementFunBind = e } })}
{#snippet propBind(context)}
<textarea bind:this={context.element}>via prop</textarea>
{/snippet}
{@render propBind({ set element(e) { elementPropBind = e } })}
{#snippet event(context)}
<button onclick={e => context.element = e.target}>via event</button>
{/snippet}
{@render event({ set element(e) { elementEvent = e } })}
Logs
System Info
REPL
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels