diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-07-09 23:29:06 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-08-21 19:42:09 -0400 |
| commit | a5326a67e37d9f1aee740f7b3d46345f3bcda419 (patch) | |
| tree | 18a1eff075e12c60e2bc2400703b9ad2cc67e7d4 /ui/routes/(swatch)/.swatch/ConversationList | |
| parent | 4624f4dbebf5dd1ed4dc5168573537459b9a115e (diff) | |
Factor data-to-JSON-string construction out of stitches.
This is a recurring and nameable operation; let's give it a name before we use it further.
Diffstat (limited to 'ui/routes/(swatch)/.swatch/ConversationList')
| -rw-r--r-- | ui/routes/(swatch)/.swatch/ConversationList/+page.svelte | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte b/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte index ef0c8a9..b0bc97a 100644 --- a/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte +++ b/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte @@ -1,27 +1,23 @@ <script> - import { json } from '$lib/swatch/derive.js'; + import * as json from '$lib/swatch/json.js'; import ConversationList from '$lib/components/ConversationList.svelte'; let conversationsInput = $state( - JSON.stringify( - [ - { - id: 'Czero', - name: 'A long conversation', - hasUnreads: false, - }, - { - id: 'Cone', - name: 'A shorter conversation', - hasUnreads: true, - }, - ], - /* replacer */ null, - /* space */ 2, - ), + json.encode([ + { + id: 'Czero', + name: 'A long conversation', + hasUnreads: false, + }, + { + id: 'Cone', + name: 'A shorter conversation', + hasUnreads: true, + }, + ]), ); - let conversations = $derived(json(conversationsInput)); + let conversations = $derived(json.decode(conversationsInput)); let active = $state(null); </script> |
