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
89 @entry.doc.fullName + if @entry.isIndex() then ' documentation' else " / #{@entry.name}"89 @entry.doc.fullName + if @entry.isIndex() then ' documentation' else " / #{@entry.name}"
90 90
91 beforeRoute: =>91 beforeRoute: =>
92 @abort()
93 @cache()92 @cache()
93 @abort()
94 return94 return
95 95
96 onRoute: (context) ->96 onRoute: (context) ->
@@ -107,7 +107,7 @@ class app.views.EntryPage extends app.View · 10 unmodified lines
107 abort: ->107 abort: ->
108 if @xhr108 if @xhr
109 @xhr.abort()109 @xhr.abort()
110 @xhr = null110 @xhr = @entry = null
111 return111 return
112 112
113 onSuccess: (response) =>113 onSuccess: (response) =>
@@ -125,7 +125,7 @@ class app.views.EntryPage extends app.View · 11 unmodified lines
125 return125 return
126 126
127 cache: ->127 cache: ->
128 return if not @entry or @cacheMap[path = @entry.filePath()]128 return if @xhr or not @entry or @cacheMap[path = @entry.filePath()]
129 129
130 @cacheMap[path] = @el.innerHTML130 @cacheMap[path] = @el.innerHTML
131 @cacheStack.push(path)131 @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
46 return46 return
47 47
48 openFirst: ->48 openFirst: ->
49 setTimeout (=> @el.firstElementChild?.click()), 049 @el.firstElementChild?.click()
50 return50 return
51 51
52 onDocEnabled: (doc) ->52 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