History

Fix race-condition when auto-opening first search result

Fixes #604.

Thibaut Courouble committed 9 years ago

Commit dcca46c1 parent 97dbb2a2 files · +4 −4Browse files

Unified · Split

2 files
  1. assets/javascripts/views/content/entry_page.coffee +3 −3
  2. assets/javascripts/views/sidebar/results.coffee +1 −1
assets/javascripts/views/content/entry_page.coffee+3−3
@@ -89,8 +89,8 @@ class app.views.EntryPage extends app.View · 88 unmodified lines
8989 @entry.doc.fullName + if @entry.isIndex() then ' documentation' else " / #{@entry.name}"
9090
9191 beforeRoute: =>
92− @abort()
9392 @cache()
93+ @abort()
9494 return
9595
9696 onRoute: (context) ->
@@ -107,7 +107,7 @@ class app.views.EntryPage extends app.View · 10 unmodified lines
107107 abort: ->
108108 if @xhr
109109 @xhr.abort()
110− @xhr = null
110+ @xhr = @entry = null
111111 return
112112
113113 onSuccess: (response) =>
@@ -125,7 +125,7 @@ class app.views.EntryPage extends app.View · 11 unmodified lines
125125 return
126126
127127 cache: ->
128− return if not @entry or @cacheMap[path = @entry.filePath()]
128+ return if @xhr or not @entry or @cacheMap[path = @entry.filePath()]
129129
130130 @cacheMap[path] = @el.innerHTML
131131 @cacheStack.push(path)
assets/javascripts/views/sidebar/results.coffee+1−1
@@ -46,7 +46,7 @@ class app.views.Results extends app.View · 45 unmodified lines
4646 return
4747
4848 openFirst: ->
49− setTimeout (=> @el.firstElementChild?.click()), 0
49+ @el.firstElementChild?.click()
5050 return
5151
5252 onDocEnabled: (doc) ->

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t