From 0ce524897ae27886769099b3749eba041ada8227 Mon Sep 17 00:00:00 2001 From: Pavel Meyer Date: Tue, 12 Sep 2023 13:39:24 +0300 Subject: [PATCH] CW-2054 Fixed infinity loading for guest user --- src/services/CommonFeedObjectUserUnique.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/services/CommonFeedObjectUserUnique.ts b/src/services/CommonFeedObjectUserUnique.ts index b391bb358d..b2f7109902 100644 --- a/src/services/CommonFeedObjectUserUnique.ts +++ b/src/services/CommonFeedObjectUserUnique.ts @@ -40,9 +40,15 @@ class CommonFeedObjectUserUniqueService { feedObjectId: string, callback: (data: CommonFeedObjectUserUnique) => void, ): UnsubscribeFunction => { - const query = this.getCommonFeedObjectUserUniqueSubCollection(commonId) - .where("feedObjectId", "==", feedObjectId) - .where("userId", "==", userId); + let query = this.getCommonFeedObjectUserUniqueSubCollection(commonId).where( + "feedObjectId", + "==", + feedObjectId, + ); + + if (userId) { + query = query.where("userId", "==", userId); + } return query.onSnapshot((snapshot) => { const data = snapshot.docChanges()[0]?.doc.data();