diff --git a/lib/selectors/socket-selectors.js b/lib/selectors/socket-selectors.js --- a/lib/selectors/socket-selectors.js +++ b/lib/selectors/socket-selectors.js @@ -147,8 +147,12 @@ const hashResults: { [string]: boolean } = {}; for (const key in serverRequest.hashesToCheck) { const expectedHashValue = serverRequest.hashesToCheck[key]; - let hashValue; const [specKey, id] = key.split('|'); + if (specPerInnerHashKey[specKey]?.hashingInProgress) { + hashResults[key] = true; + continue; + } + let hashValue; if (id) { hashValue = specPerInnerHashKey[specKey]?.getInfoHash( id, @@ -161,11 +165,7 @@ ); } - // If hashValue values is null then we are still calculating - // the hashes in the background. In this case we return true - // to skip this state check. Future state checks (after the hash - // calculation complete) will be handled normally. - // Another case when this is null is when we are handling state + // The hashValue is null when we are handling state // sync with a non-authoritative keyserver. We don't want to sync // user store and current user info with such keyservers. if (!hashValue) { diff --git a/lib/shared/state-sync/state-sync-spec.js b/lib/shared/state-sync/state-sync-spec.js --- a/lib/shared/state-sync/state-sync-spec.js +++ b/lib/shared/state-sync/state-sync-spec.js @@ -31,5 +31,6 @@ +getInfoHash: (id: string, keyserverID: string) => ?number, +getAllInfosHash: (query: CalendarQuery, keyserverID: string) => ?number, +getIDs: (query: CalendarQuery, keyserverID: string) => ?Array, + +hashingInProgress?: boolean, ...StateSyncSpec, }; diff --git a/lib/shared/state-sync/threads-state-sync-spec.js b/lib/shared/state-sync/threads-state-sync-spec.js --- a/lib/shared/state-sync/threads-state-sync-spec.js +++ b/lib/shared/state-sync/threads-state-sync-spec.js @@ -51,6 +51,7 @@ .filter(id => extractKeyserverIDFromID(id) === keyserverID) .map(id => id.split('|')[1]) : () => null, + hashingInProgress: threadHashingComplete, }), );