From d57d68116ee8e5af583ef0bb1f87cf3f40d2b845 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 20 Feb 2025 17:21:18 -0500 Subject: 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. --- ui/routes/(app)/+layout.svelte | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'ui') 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; -- cgit v1.2.3 From 60f6b298329728fc8a91cd8c688c9b38fa302f0d Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 20 Feb 2025 18:41:18 -0500 Subject: Remove the last lingering Svelte4-style event bindings. --- ui/routes/(app)/+layout.svelte | 8 ++++---- ui/routes/(app)/ch/[channel]/+page.svelte | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ui') diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index 3752bef..5ec84d9 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -99,18 +99,18 @@ } }); - function beforeUnload(evt) { - evt.preventDefault(); + function onbeforeunload(event) { + event.preventDefault(); if (events !== null) { events.close(); } // For some compat reasons? - evt.returnValue = ''; + event.returnValue = ''; return ''; } - + diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte index dbdb507..9335198 100644 --- a/ui/routes/(app)/ch/[channel]/+page.svelte +++ b/ui/routes/(app)/ch/[channel]/+page.svelte @@ -58,7 +58,7 @@ } let lastReadCallback = null; - function handleScroll() { + function onscroll() { clearTimeout(lastReadCallback); // Fine if lastReadCallback is null still. lastReadCallback = setTimeout(setLastRead, 2 * 1000); } @@ -66,7 +66,7 @@ -
+
-- cgit v1.2.3 From d0cc34800243807dc1e4d352375566fde3b0f950 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 20 Feb 2025 21:15:44 -0500 Subject: Use axios to compute event stream URL, why not. It's amazing what you can learn by skimming the docs. --- ui/lib/apiServer.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ui') diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js index e52daff..e541d43 100644 --- a/ui/lib/apiServer.js +++ b/ui/lib/apiServer.js @@ -55,9 +55,13 @@ export async function acceptInvite(inviteId, username, password) { } export function subscribeToEvents(resumePoint) { - const eventsUrl = new URL('/api/events', window.location); - eventsUrl.searchParams.append('resume_point', resumePoint); - const evtSource = new EventSource(eventsUrl.toString()); + const eventsUrl = apiServer.getUri({ + url: '/events', + params: { + resume_point: resumePoint + } + }); + const evtSource = new EventSource(eventsUrl); // TODO: this should process all incoming events and store them. // TODO: eventually we'll need to handle expiring old info, so as not to use // infinite browser memory. -- cgit v1.2.3 From 5cff84a375f64537c44f6418496f1dc1b24a1de8 Mon Sep 17 00:00:00 2001 From: Owen Jacobson 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/lib/apiServer.js | 70 +----------------------------------------- ui/lib/store.js | 61 ++++++++++++++++++++++++++++++++++++ ui/routes/(app)/+layout.svelte | 3 +- 3 files changed, 64 insertions(+), 70 deletions(-) (limited to 'ui') diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js index e541d43..bb0a587 100644 --- a/ui/lib/apiServer.js +++ b/ui/lib/apiServer.js @@ -61,73 +61,5 @@ export function subscribeToEvents(resumePoint) { resume_point: resumePoint } }); - const evtSource = new EventSource(eventsUrl); - // TODO: this should process all incoming events and store them. - // TODO: eventually we'll need to handle expiring old info, so as not to use - // infinite browser memory. - /* - * Known message types as of now: - * - created: a channel is created. - * - action: ignore. - * - message: a message is created. - * - action: display message in channel. - * - message_deleted: a message is deleted. - * - action: replace message with <...>. - * - deleted: a channel is deleted. - * - action: remove channel from sidebar. - */ - evtSource.onmessage = (evt) => { - const data = JSON.parse(evt.data); - - switch (data.type) { - case 'login': - onLoginEvent(data); - break; - case 'channel': - onChannelEvent(data); - break; - case 'message': - onMessageEvent(data); - break; - } - }; - - return evtSource; -} - -function onLoginEvent(data) { - switch (data.event) { - case 'created': - logins.update((value) => value.addLogin(data.id, data.name)); - break; - } -} - -function onChannelEvent(data) { - switch (data.event) { - case 'created': - channelsList.update((value) => value.addChannel(data.id, data.name)); - break; - case 'deleted': - channelsList.update((value) => value.deleteChannel(data.id)); - messages.update((value) => value.deleteChannel(data.id)); - break; - } -} - -function onMessageEvent(data) { - switch (data.event) { - case 'sent': - messages.update((value) => - value.addMessage(data.channel, data.id, { - at: data.at, - sender: data.sender, - body: data.body - }) - ); - break; - case 'deleted': - messages.update((value) => value.deleteMessage(data.id)); - break; - } + return new EventSource(eventsUrl); } diff --git a/ui/lib/store.js b/ui/lib/store.js index 47ebbc2..c179dac 100644 --- a/ui/lib/store.js +++ b/ui/lib/store.js @@ -7,3 +7,64 @@ export const currentUser = writable(null); export const logins = writable(new Logins()); export const channelsList = writable(new Channels()); export const messages = writable(new Messages()); + +export function onEvent(event) { + switch (event.type) { + case 'login': + onLoginEvent(event); + break; + case 'channel': + onChannelEvent(event); + break; + case 'message': + onMessageEvent(event); + break; + } +} + +onEvent.fromJson = (event) => { + const parsed = JSON.parse(event); + return onEvent(parsed); +}; + +onEvent.fromMessage = (message) => { + const data = message.data; + return onEvent.fromJson(data); +}; + +function onLoginEvent(event) { + switch (event.event) { + case 'created': + logins.update((value) => value.addLogin(event.id, event.name)); + break; + } +} + +function onChannelEvent(event) { + switch (event.event) { + case 'created': + channelsList.update((value) => value.addChannel(event.id, event.name)); + break; + case 'deleted': + channelsList.update((value) => value.deleteChannel(event.id)); + messages.update((value) => value.deleteChannel(event.id)); + break; + } +} + +function onMessageEvent(event) { + switch (event.event) { + case 'sent': + messages.update((value) => + value.addMessage(event.channel, event.id, { + at: event.at, + sender: event.sender, + body: event.body + }) + ); + break; + case 'deleted': + messages.update((value) => value.deleteMessage(event.id)); + break; + } +} 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 From 84bd8df52c342bf809db627ea0463c6809274181 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 16:04:31 -0500 Subject: Remove references to nonexistent italic variants of FiraCode --- ui/styles/fonts.css | 109 ++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 59 deletions(-) (limited to 'ui') diff --git a/ui/styles/fonts.css b/ui/styles/fonts.css index 06f69c8..c72f481 100644 --- a/ui/styles/fonts.css +++ b/ui/styles/fonts.css @@ -1,84 +1,75 @@ /*** Roboto ***/ @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Regular.ttf') format('truetype'); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-Regular.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; } + @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Bold.ttf') format('truetype'); - font-weight: bold; - font-style: normal; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-Bold.ttf') format('truetype'); + font-weight: bold; + font-style: normal; + font-display: swap; } + @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Italic.ttf') format('truetype'); - font-weight: normal; - font-style: italic; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-Italic.ttf') format('truetype'); + font-weight: normal; + font-style: italic; + font-display: swap; } + @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype'); - font-weight: bold; - font-style: italic; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype'); + font-weight: bold; + font-style: italic; + font-display: swap; } /*** Archistico ***/ @font-face { - font-family: 'Archistico'; - src: url('../fonts/Archistico_Simple.ttf') format('truetype'); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: 'Archistico'; + src: url('../fonts/Archistico_Simple.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; } + @font-face { - font-family: 'Archistico'; - src: url('../fonts/Archistico_Bold.ttf') format('truetype'); - font-weight: bold; - font-style: normal; - font-display: swap; + font-family: 'Archistico'; + src: url('../fonts/Archistico_Bold.ttf') format('truetype'); + font-weight: bold; + font-style: normal; + font-display: swap; } /*** FiraCode ***/ @font-face { - font-family: 'FiraCode'; - src: url('../fonts/FiraCode-Regular.otf') format('opentype'); - font-weight: normal; - font-style: normal; - font-display: swap; -} -@font-face { - font-family: 'FiraCode'; - src: url('../fonts/FiraCode-Bold.otf') format('opentype'); - font-weight: bold; - font-style: normal; - font-display: swap; -} -@font-face { - font-family: 'FiraCode'; - src: url('../fonts/FiraCode-Italic.otf') format('opentype'); - font-weight: normal; - font-style: italic; - font-display: swap; + font-family: 'FiraCode'; + src: url('../fonts/FiraCode-Regular.otf') format('opentype'); + font-weight: normal; + font-style: normal; + font-display: swap; } + @font-face { - font-family: 'FiraCode'; - src: url('../fonts/FiraCode-BoldItalic.otf') format('opentype'); - font-weight: bold; - font-style: italic; - font-display: swap; + font-family: 'FiraCode'; + src: url('../fonts/FiraCode-Bold.otf') format('opentype'); + font-weight: bold; + font-style: normal; + font-display: swap; } /*** Overlock ***/ @font-face { - font-family: 'Overlock'; - src: url('../fonts/Overlock-Regular.ttf') format('truetype'); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: 'Overlock'; + src: url('../fonts/Overlock-Regular.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; } -- cgit v1.2.3 From f905b6fb1c3e34faaa3014009e994813842a7ffa Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 16:05:00 -0500 Subject: Remove nonexistent CSS variable --- ui/styles/fonts.css | 90 +++++++++++++++++++++++++------------------------- ui/styles/messages.css | 2 +- 2 files changed, 46 insertions(+), 46 deletions(-) (limited to 'ui') diff --git a/ui/styles/fonts.css b/ui/styles/fonts.css index c72f481..280f8c6 100644 --- a/ui/styles/fonts.css +++ b/ui/styles/fonts.css @@ -1,75 +1,75 @@ /*** Roboto ***/ @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Regular.ttf') format('truetype'); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-Regular.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; } @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Bold.ttf') format('truetype'); - font-weight: bold; - font-style: normal; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-Bold.ttf') format('truetype'); + font-weight: bold; + font-style: normal; + font-display: swap; } @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-Italic.ttf') format('truetype'); - font-weight: normal; - font-style: italic; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-Italic.ttf') format('truetype'); + font-weight: normal; + font-style: italic; + font-display: swap; } @font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype'); - font-weight: bold; - font-style: italic; - font-display: swap; + font-family: 'Roboto'; + src: url('../fonts/Roboto-BoldItalic.ttf') format('truetype'); + font-weight: bold; + font-style: italic; + font-display: swap; } /*** Archistico ***/ @font-face { - font-family: 'Archistico'; - src: url('../fonts/Archistico_Simple.ttf') format('truetype'); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: 'Archistico'; + src: url('../fonts/Archistico_Simple.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; } @font-face { - font-family: 'Archistico'; - src: url('../fonts/Archistico_Bold.ttf') format('truetype'); - font-weight: bold; - font-style: normal; - font-display: swap; + font-family: 'Archistico'; + src: url('../fonts/Archistico_Bold.ttf') format('truetype'); + font-weight: bold; + font-style: normal; + font-display: swap; } /*** FiraCode ***/ @font-face { - font-family: 'FiraCode'; - src: url('../fonts/FiraCode-Regular.otf') format('opentype'); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: 'FiraCode'; + src: url('../fonts/FiraCode-Regular.otf') format('opentype'); + font-weight: normal; + font-style: normal; + font-display: swap; } @font-face { - font-family: 'FiraCode'; - src: url('../fonts/FiraCode-Bold.otf') format('opentype'); - font-weight: bold; - font-style: normal; - font-display: swap; + font-family: 'FiraCode'; + src: url('../fonts/FiraCode-Bold.otf') format('opentype'); + font-weight: bold; + font-style: normal; + font-display: swap; } /*** Overlock ***/ @font-face { - font-family: 'Overlock'; - src: url('../fonts/Overlock-Regular.ttf') format('truetype'); - font-weight: normal; - font-style: normal; - font-display: swap; + font-family: 'Overlock'; + src: url('../fonts/Overlock-Regular.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; } diff --git a/ui/styles/messages.css b/ui/styles/messages.css index c4ef106..7d0b870 100644 --- a/ui/styles/messages.css +++ b/ui/styles/messages.css @@ -51,6 +51,7 @@ .message:hover { background-color: var(--colour-message-hover-bg); } + .message:hover * { color: var(--colour-message-hover-text); } @@ -112,7 +113,6 @@ .message-body pre { border: 1px solid #312e81; border-radius: 0.25rem; - background-color: var(--colour-message-run-text); padding: 0.25rem; } -- cgit v1.2.3 From d7b1a995b7da423531933888cde04ae6d807298b Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 16:13:30 -0500 Subject: Provide fallback generic fonts for our custom fonts --- ui/app.css | 2 +- ui/styles/app-bar.css | 2 +- ui/styles/forms.css | 4 ++-- ui/styles/messages.css | 2 +- ui/styles/textarea.css | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ui') diff --git a/ui/app.css b/ui/app.css index e7da4d8..646c418 100644 --- a/ui/app.css +++ b/ui/app.css @@ -14,7 +14,7 @@ body { background-color: var(--colour-active-channel-bg); color: var(--dark-text); - font-family: 'Roboto'; + font-family: 'Roboto', sans-serif; } hr { diff --git a/ui/styles/app-bar.css b/ui/styles/app-bar.css index 17620ba..0d0a311 100644 --- a/ui/styles/app-bar.css +++ b/ui/styles/app-bar.css @@ -28,7 +28,7 @@ .app-bar > a { line-height: var(--app-bar-height); - font-family: 'Archistico'; + font-family: 'Archistico', serif; letter-spacing: 0.25rem; } diff --git a/ui/styles/forms.css b/ui/styles/forms.css index 88a6c41..eb98743 100644 --- a/ui/styles/forms.css +++ b/ui/styles/forms.css @@ -5,7 +5,7 @@ label { } label input { - font-family: 'Overlock'; + font-family: 'Overlock', cursive; display: block; width: 90%; padding: 0.25rem; @@ -14,7 +14,7 @@ label input { } form.form > button { - font-family: 'Overlock'; + font-family: 'Overlock', cursive; background-color: var(--colour-input-bg); color: var(--colour-input-text); padding: 0.25rem; diff --git a/ui/styles/messages.css b/ui/styles/messages.css index 7d0b870..4890f2c 100644 --- a/ui/styles/messages.css +++ b/ui/styles/messages.css @@ -118,5 +118,5 @@ .message-body code, .message-body pre { - font-family: 'FiraCode'; + font-family: 'FiraCode', monospace; } diff --git a/ui/styles/textarea.css b/ui/styles/textarea.css index d9be0d6..4b8602c 100644 --- a/ui/styles/textarea.css +++ b/ui/styles/textarea.css @@ -18,7 +18,7 @@ flex-grow: 1; background-color: var(--colour-input-bg); color: var(--colour-input-text); - font-family: 'FiraCode'; + font-family: 'FiraCode', monospace; } .create-message button { -- cgit v1.2.3 From b52075ea197baa5a8a301b04948f9286cfb107a9 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 16:15:40 -0500 Subject: Remove duplicate `content` hack from reset. According to , this was needed for old versions of Safari. However, since at least 2022, Safari has supported `content: none` just fine. Related Safari bug (still open as of this writing, comments relevnat): --- ui/styles/reset.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/styles/reset.css b/ui/styles/reset.css index f9fa505..5a17f02 100644 --- a/ui/styles/reset.css +++ b/ui/styles/reset.css @@ -93,6 +93,7 @@ video { /* font: inherit; */ vertical-align: baseline; } + /* HTML5 display-role reset for older browsers */ article, aside, @@ -107,24 +108,28 @@ nav, section { display: block; } + body { line-height: 1; } + ol, ul { list-style: none; } + blockquote, q { quotes: none; } + blockquote:before, blockquote:after, q:before, q:after { - content: ''; content: none; } + table { border-collapse: collapse; border-spacing: 0; -- cgit v1.2.3 From 01368abc9893caa7acd3d632fd7a2d4284e64167 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 16:21:43 -0500 Subject: Remove unused type attribute on textarea --- ui/lib/components/MessageInput.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/lib/components/MessageInput.svelte b/ui/lib/components/MessageInput.svelte index 5869654..1eb1d7b 100644 --- a/ui/lib/components/MessageInput.svelte +++ b/ui/lib/components/MessageInput.svelte @@ -24,7 +24,6 @@
- +
-- cgit v1.2.3 From 5245aba8b80f458d25eb3249c0b8cc3fe744311d Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 16:27:00 -0500 Subject: Be a bit more careful with the nesting of anchors and list items. Browsers cope with weird nestings mostly fine, but there's no upside for us in testing that. --- ui/lib/components/Channel.svelte | 8 ++++---- ui/styles/sidebar.css | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/lib/components/Channel.svelte b/ui/lib/components/Channel.svelte index c73340f..4f908d2 100644 --- a/ui/lib/components/Channel.svelte +++ b/ui/lib/components/Channel.svelte @@ -2,13 +2,13 @@ let { id, name, active, hasUnreads } = $props(); - -
  • +
  • + {#if hasUnreads} {:else} {/if} {name} -
  • - + + diff --git a/ui/styles/sidebar.css b/ui/styles/sidebar.css index 5e5e16a..c6aab6a 100644 --- a/ui/styles/sidebar.css +++ b/ui/styles/sidebar.css @@ -4,6 +4,8 @@ } .list-nav a { + display: block; + padding: 0.5rem; text-decoration: none; } @@ -12,7 +14,6 @@ } .list-nav li { - padding: 0.5rem; border-radius: 0.5rem; border: 1px solid var(--colour-navbar-border); margin: 0.25rem; -- cgit v1.2.3 From b9bc643af0d0523a70d76236d9277539da083b36 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 16:35:56 -0500 Subject: Add missing awaits on goto() calls --- ui/lib/components/LogOut.svelte | 2 +- ui/routes/(app)/+layout.svelte | 8 ++++---- ui/routes/(login)/invite/[invite]/+page.svelte | 2 +- ui/routes/(login)/login/+page.svelte | 2 +- ui/routes/(login)/setup/+page.svelte | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ui') diff --git a/ui/lib/components/LogOut.svelte b/ui/lib/components/LogOut.svelte index b699cfd..1cb8fb5 100644 --- a/ui/lib/components/LogOut.svelte +++ b/ui/lib/components/LogOut.svelte @@ -8,7 +8,7 @@ const response = await logOut(); if (200 <= response.status && response.status < 300) { currentUser.set(null); - goto('/login'); + await goto('/login'); } } diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index dff9245..a81efce 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -2,11 +2,11 @@ import { page } from '$app/stores'; import { goto } from '$app/navigation'; import { browser } from '$app/environment'; - import { onMount, onDestroy, getContext } from 'svelte'; + import { getContext, onDestroy, onMount } from 'svelte'; import TinyGesture from 'tinygesture'; import { boot, subscribeToEvents } from '$lib/apiServer'; - import { currentUser, logins, channelsList, messages, onEvent } from '$lib/store'; + import { channelsList, currentUser, logins, messages, onEvent } from '$lib/store'; import ChannelList from '$lib/components/ChannelList.svelte'; import CreateChannelForm from '$lib/components/CreateChannelForm.svelte'; @@ -76,11 +76,11 @@ break; case 401: currentUser.set(null); - goto('/login'); + await goto('/login'); break; case 503: currentUser.set(null); - goto('/setup'); + await goto('/setup'); break; default: // TODO: display error. diff --git a/ui/routes/(login)/invite/[invite]/+page.svelte b/ui/routes/(login)/invite/[invite]/+page.svelte index 132cbc1..0c01286 100644 --- a/ui/routes/(login)/invite/[invite]/+page.svelte +++ b/ui/routes/(login)/invite/[invite]/+page.svelte @@ -18,7 +18,7 @@ if (200 <= response.status && response.status < 300) { username = ''; password = ''; - goto('/'); + await goto('/'); } pending = false; } diff --git a/ui/routes/(login)/login/+page.svelte b/ui/routes/(login)/login/+page.svelte index a1291ea..9157cef 100644 --- a/ui/routes/(login)/login/+page.svelte +++ b/ui/routes/(login)/login/+page.svelte @@ -16,7 +16,7 @@ if (200 <= response.status && response.status < 300) { username = ''; password = ''; - goto('/'); + await goto('/'); } pending = false; } diff --git a/ui/routes/(login)/setup/+page.svelte b/ui/routes/(login)/setup/+page.svelte index f162ded..c63f198 100644 --- a/ui/routes/(login)/setup/+page.svelte +++ b/ui/routes/(login)/setup/+page.svelte @@ -16,7 +16,7 @@ if (200 <= response.status && response.status < 300) { username = ''; password = ''; - goto('/'); + await goto('/'); } pending = false; } -- cgit v1.2.3 From 25daf36b18086096651b381223ad8f03fbca5045 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Fri, 21 Feb 2025 17:07:35 -0500 Subject: Retire use of $page store in favour of Sv5 page state --- ui/routes/(app)/+layout.svelte | 4 ++-- ui/routes/(app)/ch/[channel]/+page.svelte | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'ui') diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index a81efce..6339abd 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -1,5 +1,5 @@