fix svelte rendering

feat/orm-diffs
Laurin Weger 1 day ago
parent 0df0b10109
commit a4768e0340
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 9
      sdk/js/examples/multi-framework-signals/src/frontends/svelte/HelloWorld.svelte

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { TestObjectShapeType } from "../../shapes/orm/testShape.shapeTypes";
import { useShape } from "@ng-org/signals/svelte"; import { useShape } from "@ng-org/signals/svelte";
import flattenObject from "../utils/flattenObject"; import flattenObject from "../utils/flattenObject";
import { BasicShapeType } from "../../shapes/orm/basic.shapeTypes"; import { BasicShapeType } from "../../shapes/orm/basic.shapeTypes";
@ -22,12 +21,10 @@
} }
const flattenedObjects = $derived( const flattenedObjects = $derived(
$shapeObjects $shapeObjects
? $shapeObjects.values().map((o) => flattenObject(o)[0] || ({} as any)) ? Array.from($shapeObjects.values()).map((o) => flattenObject(o))
: [] : []
); );
$effect(() => { (window as any).svelteState = $shapeObjects;
(window as any).svelteState = $shapeObjects;
});
</script> </script>
{#if $shapeObjects} {#if $shapeObjects}
@ -44,7 +41,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{#each flatEntries as [key, value] (key)} {#each flatEntries as [key, value]}
<tr> <tr>
<td style="white-space:nowrap;">{key}</td> <td style="white-space:nowrap;">{key}</td>
<td> <td>

Loading…
Cancel
Save