From 674afe400d464b9f340f1b41cdd2e2391950bffc Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Thu, 23 Apr 2020 07:50:54 -0400 Subject: [PATCH] Merge pull request #2755 from overleaf/jpa-fix-race-in-references-boot [frontend] ReferencesManager: fix a race condition with the socket boot GitOrigin-RevId: cf21970bfc95128047d519b7c03ea0a29740174c --- .../js/ide/references/ReferencesManager.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/services/web/frontend/js/ide/references/ReferencesManager.js b/services/web/frontend/js/ide/references/ReferencesManager.js index 7d75250eba..13f3c01fa1 100644 --- a/services/web/frontend/js/ide/references/ReferencesManager.js +++ b/services/web/frontend/js/ide/references/ReferencesManager.js @@ -49,20 +49,12 @@ define(['crypto-js/sha1'], function(CryptoJSSHA1) { // not on every reconnect if (!this.inited) { this.inited = true - return this.indexAllReferences(false) + this.ide.socket.on('references:keys:updated', keys => + this._storeReferencesKeys(keys) + ) + this.indexAllReferences(false) } }) - - setTimeout( - self => - self.ide.socket.on('references:keys:updated', keys => - // console.log '>> got keys from socket' - self._storeReferencesKeys(keys) - ), - - 1000, - this - ) } _storeReferencesKeys(newKeys) {