Preserve path when reloading the app

Fixes #849.
pull/929/head
Thibaut Courouble 6 years ago
parent f562c2face
commit a8a97e0198

@ -157,10 +157,17 @@
new app.views.Updates() new app.views.Updates()
@updateChecker = new app.UpdateChecker() @updateChecker = new app.UpdateChecker()
reboot: ->
if location.pathname isnt '/'
window.location = "/##{location.pathname}"
else
window.location = '/'
return
reload: -> reload: ->
@docs.clearCache() @docs.clearCache()
@disabledDocs.clearCache() @disabledDocs.clearCache()
if @appCache then @appCache.reload() else window.location = '/' if @appCache then @appCache.reload() else @reboot()
return return
reset: -> reset: ->

@ -27,7 +27,11 @@ class app.AppCache
return return
reload: -> reload: ->
$.on @cache, 'updateready noupdate error', -> window.location = '/' $.on @cache, 'updateready noupdate error', ->
if location.pathname isnt '/'
window.location = "/##{location.pathname}"
else
window.location = '/'
@notifyUpdate = false @notifyUpdate = false
@notifyProgress = true @notifyProgress = true
try @cache.update() catch try @cache.update() catch

@ -77,7 +77,7 @@ class app.views.Document extends app.View
switch target.getAttribute('data-behavior') switch target.getAttribute('data-behavior')
when 'back' then history.back() when 'back' then history.back()
when 'reload' then window.location.reload() when 'reload' then window.location.reload()
when 'reboot' then window.location = '/' when 'reboot' then app.reboot()
when 'hard-reload' then app.reload() when 'hard-reload' then app.reload()
when 'reset' then app.reset() if confirm('Are you sure you want to reset DevDocs?') when 'reset' then app.reset() if confirm('Are you sure you want to reset DevDocs?')
return return

Loading…
Cancel
Save