Fix race condition between clearing index and inserting rest of catalog.

This commit is contained in:
ccd0 2016-10-03 00:19:39 -07:00
parent 8115d7d136
commit 28e2ea7af7

View File

@ -807,9 +807,11 @@ Index =
buildCatalog: (threadIDs) ->
i = 0
n = threadIDs.length
node0 = null
fn = ->
return if node0 and !node0.parentNode # Index.root cleared
j = if i > 0 and Index.root.parentNode then n else i + 30
Index.buildCatalogPart threadIDs[i...j]
node0 = Index.buildCatalogPart(threadIDs[i...j])[0]
i = j
if i < n
$.queueTask fn
@ -831,7 +833,7 @@ Index =
$.add thread.catalogView.nodes.root, thread.OP.nodes.root
nodes.push thread.catalogView.nodes.root
$.add Index.root, nodes
return
nodes
clearSearch: ->
Index.searchInput.value = ''