message_list_data_cache: Update when receiving new messages.

If we receive a message that we can add to the data cache without
talking to the server, we do that, otherwise we remove it from the
cache to avoid us having wrong filter status cached.
This commit is contained in:
Aman Agrawal
2024-08-18 17:08:27 +00:00
committed by Tim Abbott
parent 5b9a2584c5
commit 21b6bb9887
4 changed files with 20 additions and 8 deletions

View File

@@ -88,3 +88,12 @@ export function get_superset_datasets(filter: Filter): MessageListData[] {
return [...superset_datasets, all_messages_data.all_messages_data];
}
export function remove(filter: Filter): void {
for (const [key, cached_data] of cache.entries()) {
if (cached_data.filter.equals(filter)) {
cache.delete(key);
return;
}
}
}