Fix race-condition when auto-opening first search result

Fixes #604.
pull/602/merge
Thibaut Courouble 8 years ago
parent 97dbb2afde
commit dcca46cd0f

@ -89,8 +89,8 @@ class app.views.EntryPage extends app.View
@entry.doc.fullName + if @entry.isIndex() then ' documentation' else " / #{@entry.name}" @entry.doc.fullName + if @entry.isIndex() then ' documentation' else " / #{@entry.name}"
beforeRoute: => beforeRoute: =>
@abort()
@cache() @cache()
@abort()
return return
onRoute: (context) -> onRoute: (context) ->
@ -107,7 +107,7 @@ class app.views.EntryPage extends app.View
abort: -> abort: ->
if @xhr if @xhr
@xhr.abort() @xhr.abort()
@xhr = null @xhr = @entry = null
return return
onSuccess: (response) => onSuccess: (response) =>
@ -125,7 +125,7 @@ class app.views.EntryPage extends app.View
return return
cache: -> cache: ->
return if not @entry or @cacheMap[path = @entry.filePath()] return if @xhr or not @entry or @cacheMap[path = @entry.filePath()]
@cacheMap[path] = @el.innerHTML @cacheMap[path] = @el.innerHTML
@cacheStack.push(path) @cacheStack.push(path)

@ -46,7 +46,7 @@ class app.views.Results extends app.View
return return
openFirst: -> openFirst: ->
setTimeout (=> @el.firstElementChild?.click()), 0 @el.firstElementChild?.click()
return return
onDocEnabled: (doc) -> onDocEnabled: (doc) ->

Loading…
Cancel
Save