Skip to content
Discussion options

You must be logged in to vote

The workaround I found is similar to that you suggest.

<script>
        import { writable } from 'svelte/store'

	export let data;

	let title = writable(data.todo.title)
        $: title.set(data.todo.title)
</script>

<input type="text" bind:value={$title} />

{#if $title !== data.todo.title}
	<button>Save</button>
{/if}

It uses svelte store and update the title when data changes. I use svelte store because this will not work as it define new calculated value title.

let title = data.todo.title
$:title=data.todo.title

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@eltigerchino
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@eltigerchino
Comment options

@anuragkumar19
Comment options

Answer selected by anuragkumar19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #10939 on October 27, 2023 12:28.