improve reactivity check for big objects on app

This commit is contained in:
Ruben Fiszel
2023-03-09 18:34:30 +01:00
parent 6b0fb75d23
commit fd52740d5d
+2 -1
View File
@@ -1,5 +1,6 @@
import type { AppInput } from './inputType'
import { writable, type Writable } from 'svelte/store'
import { deepEqual } from 'fast-equals'
export interface Subscriber<T> {
next(v: T)
@@ -153,7 +154,7 @@ export function settableOutput<T>(state: Writable<number>, previousValue: T): Ou
}
function set(x: T, force: boolean = false) {
if (value != x || force) {
if (!deepEqual(value, x) || force) {
state.update((x) => x + 1)
value = x