mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 13:57:55 -05:00
Use waitFor
when refreshing the binary file view
This commit is contained in:
parent
3849bcfb40
commit
19d8700947
1 changed files with 7 additions and 13 deletions
|
@ -47,18 +47,6 @@ define [
|
||||||
else
|
else
|
||||||
return url
|
return url
|
||||||
|
|
||||||
_tryOpenFile = (new_file_id) ->
|
|
||||||
iterations = 0
|
|
||||||
do tryOpen = () ->
|
|
||||||
if iterations > 10
|
|
||||||
return
|
|
||||||
iterations += 1
|
|
||||||
newFile = ide.fileTreeManager.findEntityById(new_file_id)
|
|
||||||
if newFile?
|
|
||||||
ide.binaryFilesManager.openFile(newFile)
|
|
||||||
else
|
|
||||||
setTimeout(tryOpen, 500)
|
|
||||||
|
|
||||||
$scope.refreshFile = (file) ->
|
$scope.refreshFile = (file) ->
|
||||||
$scope.refreshing = true
|
$scope.refreshing = true
|
||||||
$scope.refreshError = null
|
$scope.refreshError = null
|
||||||
|
@ -68,7 +56,13 @@ define [
|
||||||
{ new_file_id } = data
|
{ new_file_id } = data
|
||||||
$timeout(
|
$timeout(
|
||||||
() ->
|
() ->
|
||||||
_tryOpenFile(new_file_id)
|
ide.waitFor(
|
||||||
|
() ->
|
||||||
|
ide.fileTreeManager.findEntityById(new_file_id)
|
||||||
|
(newFile) ->
|
||||||
|
ide.binaryFilesManager.openFile(newFile)
|
||||||
|
5000
|
||||||
|
)
|
||||||
, 0
|
, 0
|
||||||
)
|
)
|
||||||
$scope.refreshError = null
|
$scope.refreshError = null
|
||||||
|
|
Loading…
Reference in a new issue