From af8dc0198c6a22996ce54690cf7141694dd11eaf Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Thu, 15 May 2025 19:58:35 -0400 Subject: Fix up spots where we still tried to treat `remote.channels.all` as a map. In ae93188f0f4f36086622636ba9ae4810cbd1f8c9, `remote.channels.all` became a flat array of channels, instead of a map, in order to simplify some of the reasoning around how state changes propagate. However, I neglected to remove all Map-shaped calls referring to it. This lead to some pretty interesting behaviour: * The client could not track unread state, because reconciling local state against the remote state would find no remote state, then throw away local state entirely as a result. * The client would not actually update when a new channel appeared. * The client would not actually update when a channel disappeared. --- ui/lib/state/local/channels.svelte.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui/lib/state/local/channels.svelte.js') diff --git a/ui/lib/state/local/channels.svelte.js b/ui/lib/state/local/channels.svelte.js index d86d028..e3ee8df 100644 --- a/ui/lib/state/local/channels.svelte.js +++ b/ui/lib/state/local/channels.svelte.js @@ -82,7 +82,8 @@ export class Channels { } } - retainChannels(channelIds) { + retainChannels(channels) { + const channelIds = channels.map((channel) => channel.id); const retain = new Set(channelIds); for (const channelId of Array.from(this.all.keys())) { if (!retain.has(channelId)) { -- cgit v1.2.3