UBERF-8592: Fix live query performance (#7189)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2024-11-21 14:38:14 +07:00
committed by GitHub
parent 13df48d7c9
commit b5f24fbd5d
25 changed files with 674 additions and 380 deletions
@@ -63,14 +63,14 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
)
readonly inboxNotificationsByContext = derived(
[this.contexts, this.inboxNotifications],
([notifyContexts, inboxNotifications]) => {
if (inboxNotifications.length === 0 || notifyContexts.length === 0) {
[this.contextById, this.inboxNotifications],
([contextById, inboxNotifications]) => {
if (inboxNotifications.length === 0 || contextById.size === 0) {
return new Map<Ref<DocNotifyContext>, InboxNotification[]>()
}
return inboxNotifications.reduce((result, notification) => {
const notifyContext = notifyContexts.find(({ _id }) => _id === notification.docNotifyContext)
const notifyContext = contextById.get(notification.docNotifyContext)
if (notifyContext === undefined) {
return result