mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-20 16:25:43 +00:00
Use waitFor
when restoring a file in v2 history
This commit is contained in:
parent
19d8700947
commit
e33b7b1a49
1 changed files with 10 additions and 13 deletions
|
@ -24,17 +24,14 @@ define [
|
|||
$scope.restoreState.inflight = false
|
||||
|
||||
openEntity = (data) ->
|
||||
iterations = 0
|
||||
{id, type} = data
|
||||
do tryOpen = () ->
|
||||
if iterations > 5
|
||||
return
|
||||
iterations += 1
|
||||
entity = ide.fileTreeManager.findEntityById(id)
|
||||
if entity? and type == 'doc'
|
||||
ide.editorManager.openDoc(entity)
|
||||
else if entity? and type == 'file'
|
||||
ide.binaryFilesManager.openFile(entity)
|
||||
else
|
||||
setTimeout(tryOpen, 500)
|
||||
|
||||
ide.waitFor(
|
||||
() ->
|
||||
ide.fileTreeManager.findEntityById(id)
|
||||
(entity) ->
|
||||
if type == 'doc'
|
||||
ide.editorManager.openDoc(entity)
|
||||
else type == 'file'
|
||||
ide.binaryFilesManager.openFile(entity)
|
||||
3000
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue