Commit 01d1fe807ecac5563dd29fe54cc93a07904823e2
click tab when already selected to refresh a view (scrolls to top)
fixes #653Matt McKegg committed on 10/19/2017, 3:38:14 AM
Parent: f2e05ea5dbafcd1d773de66351a65641b3f48090
Files changed
main-window.js | changed |
main-window.js | ||
---|---|---|
@@ -228,9 +228,13 @@ | ||
228 | 228 | function tab (name, view) { |
229 | 229 | var instance = views.get(view) |
230 | 230 | return h('a', { |
231 | 231 | 'ev-click': function (ev) { |
232 | - if (instance.pendingUpdates && instance.pendingUpdates() && instance.reload) { | |
232 | + var isSelected = views.currentView() === view | |
233 | + var needsRefresh = instance.pendingUpdates && instance.pendingUpdates() | |
234 | + | |
235 | + // refresh if tab is clicked when there are pending items or the page is already selected | |
236 | + if ((needsRefresh || isSelected) && instance.reload) { | |
233 | 237 | instance.reload() |
234 | 238 | } |
235 | 239 | }, |
236 | 240 | href: view, |
Built with git-ssb-web