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
This commit is contained in:
Eric Mc Sween 2020-04-23 07:50:54 -04:00 committed by Copybot
parent 1dc325d1c7
commit 674afe400d

View file

@ -49,20 +49,12 @@ define(['crypto-js/sha1'], function(CryptoJSSHA1) {
// not on every reconnect // not on every reconnect
if (!this.inited) { if (!this.inited) {
this.inited = true 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) { _storeReferencesKeys(newKeys) {