From db23aaad8366f04bbecf4daf2be7acfc9bd5a5b2 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 9 Jun 2020 15:22:37 -0600 Subject: [PATCH] Destroy old CommunityFilterConditions when they aren't needed Fixes https://github.com/vector-im/riot-web/issues/13971 --- src/stores/room-list/TagWatcher.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stores/room-list/TagWatcher.ts b/src/stores/room-list/TagWatcher.ts index 1fb5223e00..22302b695d 100644 --- a/src/stores/room-list/TagWatcher.ts +++ b/src/stores/room-list/TagWatcher.ts @@ -74,6 +74,11 @@ export class TagWatcher { this.store.removeFilter(filter); } + // Destroy any and all old filter conditions to prevent resource leaks + for (const filter of this.filters.values()) { + filter.destroy(); + } + this.filters = newFilters; } };