From 5cff84a375f64537c44f6418496f1dc1b24a1de8 Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Fri, 21 Feb 2025 13:08:14 -0500
Subject: Split "set up the event source" and "apply events to state" from one
 another.

---
 ui/routes/(app)/+layout.svelte | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'ui/routes/(app)/+layout.svelte')

diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte
index 5ec84d9..dff9245 100644
--- a/ui/routes/(app)/+layout.svelte
+++ b/ui/routes/(app)/+layout.svelte
@@ -6,7 +6,7 @@
   import TinyGesture from 'tinygesture';
 
   import { boot, subscribeToEvents } from '$lib/apiServer';
-  import { currentUser, logins, channelsList, messages } from '$lib/store';
+  import { currentUser, logins, channelsList, messages, onEvent } from '$lib/store';
 
   import ChannelList from '$lib/components/ChannelList.svelte';
   import CreateChannelForm from '$lib/components/CreateChannelForm.svelte';
@@ -72,6 +72,7 @@
       case 200:
         onBooted(response.data);
         events = subscribeToEvents(response.data.resume_point);
+        events.onmessage = onEvent.fromMessage;
         break;
       case 401:
         currentUser.set(null);
-- 
cgit v1.2.3

