updated initial json field reactivity

This commit is contained in:
Gani Georgiev 2023-01-29 20:05:11 +02:00
parent 64fd347628
commit 667bcac680
1 changed files with 3 additions and 2 deletions

View File

@ -6,10 +6,11 @@
export let field = new SchemaField();
export let value = undefined;
let serialized = undefined;
let serialized = JSON.stringify(typeof value === "undefined" ? null : value, null, 2);
$: if (value !== serialized?.trim()) {
serialized = JSON.stringify(value, null, 2);
serialized = JSON.stringify(typeof value === "undefined" ? null : value, null, 2);
value = serialized;
}
</script>