I started using Svelte-5 with Sveltekit as a SPA with Firebase.In an update form I like to detect when fields change to show buttons like commit and reset when object props change.
Now I use something like this:
history = $State()let delta = $derived({ title: sectionObj.title, contra: sectionObj.contra, exposed: sectionObj.exposed, vat: sectionObj.vat, groupIds: JSON.stringify(sectionObj.groupIds.filter((g) => g !== '')), lookup: JSON.stringify(sectionObj.lookup), ignored: sectionObj.ignored, rename: sectionObj.rename,});onMount(() => { ... history = delta;});let equal = $derived(isEqual(history, delta)); // lodash
Other sugegstions?