svelte
svelte copied to clipboard
svelte component not reactive
Describe the bug
Hi , here activeGrid is reactive state , i can see activeGrid text changes.. but GridSvg with reactive component is not re-rendering when activeGrid is changed.
{#snippet button()}
<div>
{activeGrid} - this changes , but not below
<GridSvg template={activeGrid} {dimension} {strokeWidth} />
</div>
{/snippet}
{#snippet content({ togglePopup })}
<div class="gridcontainer">
content
</div>
{/snippet}
<PopMenu {button} {content} />
I even tried like this template=bindable option in my GridSvg , but still its not reactive
Reproduction
Hi , here activeGrid is reactive state , i can see activeGrid text changes.. but GridSvg with reactive component is not re-rendering when activeGrid is changed.
Logs
No response
System Info
mac
Severity
blocking all usage of svelte
Please provide a complete, minimal reproduction in the REPL, not just one of your components.
Hi , I was able to solve it by this , its rerendering the gridsvg when activeGrid is changed.
{#snippet button()}
{#key activeGrid}
<div>
<GridSvg template={activeGrid} {dimension} {strokeWidth}></GridSvg>
</div>
{/key}
{/snippet}