svelte icon indicating copy to clipboard operation
svelte copied to clipboard

svelte component not reactive

Open vishnuc opened this issue 1 year ago • 2 comments

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

vishnuc avatar Nov 16 '24 07:11 vishnuc

Please provide a complete, minimal reproduction in the REPL, not just one of your components.

Conduitry avatar Nov 16 '24 08:11 Conduitry

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}

vishnuc avatar Nov 16 '24 13:11 vishnuc