summaryrefslogtreecommitdiff
path: root/ui/lib/state/local/channels.svelte.js
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-05-15 19:58:35 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-05-15 19:58:35 -0400
commitaf8dc0198c6a22996ce54690cf7141694dd11eaf (patch)
treec58a037501f53047157e6dea0bc873334897e035 /ui/lib/state/local/channels.svelte.js
parenta38a449ab78a4e8ab56705922f5c13f9365a92a4 (diff)
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.
Diffstat (limited to 'ui/lib/state/local/channels.svelte.js')
-rw-r--r--ui/lib/state/local/channels.svelte.js3
1 files changed, 2 insertions, 1 deletions
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)) {