summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-02-20 17:21:18 -0500
committerOwen Jacobson <owen@grimoire.ca>2025-02-20 17:21:18 -0500
commitd57d68116ee8e5af583ef0bb1f87cf3f40d2b845 (patch)
tree40973f16e1ff8dd102563371a2bb5f45175c8323 /ui
parent615ec470e26492c8c73c356e147ddabba6aa15ce (diff)
Let Svelte's `$derived` handling figure out update ordering for the channels list.
This fixes a bug. To reproduce: 1. Open the client and log in. 2. Create a new channel using the `create channel` UI. The expected result - and the behaviour after this commit - is that the newly-created channel will be shown in the sidebar immediately. The buggy behaviour is that it was not, but would appear in the sidebar once the client is reloaded. The channel would also not appear for other clients until they reloaded. I'm not actually completely sure of _why_ this fixes the bug, but it does.
Diffstat (limited to 'ui')
-rw-r--r--ui/routes/(app)/+layout.svelte10
1 files changed, 2 insertions, 8 deletions
diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte
index cbfef54..3752bef 100644
--- a/ui/routes/(app)/+layout.svelte
+++ b/ui/routes/(app)/+layout.svelte
@@ -19,14 +19,8 @@
let loading = $state(true);
let channel = $derived($page.params.channel);
- let rawChannels;
- channelsList.subscribe((val) => {
- rawChannels = val.channels;
- });
- let rawMessages;
- messages.subscribe((val) => {
- rawMessages = val;
- });
+ let rawChannels = $derived($channelsList.channels);
+ let rawMessages = $derived($messages);
let enrichedChannels = $derived.by(() => {
const channels = rawChannels;