From 29defa3e573b91202db7c235c9c56139ceecf1f5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 20 Jul 2020 14:36:12 +0100 Subject: [PATCH] Tag Watcher don't create new filter if not needed, confuses references Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/stores/room-list/TagWatcher.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stores/room-list/TagWatcher.ts b/src/stores/room-list/TagWatcher.ts index 1c16571e5b..81cbc84be1 100644 --- a/src/stores/room-list/TagWatcher.ts +++ b/src/stores/room-list/TagWatcher.ts @@ -54,7 +54,11 @@ export class TagWatcher { continue; } - newFilters.set(tag, new CommunityFilterCondition(group)); + let filter = this.filters.get(tag); + if (!filter) { + filter = new CommunityFilterCondition(group); + } + newFilters.set(tag, filter); } // Update the room list store's filters @@ -73,10 +77,6 @@ export class TagWatcher { if (!filter) continue; this.store.removeFilter(filter); - } - - // Destroy any and all old filter conditions to prevent resource leaks - for (const filter of this.filters.values()) { filter.destroy(); }