Fix random page reload, hopefully

This commit is contained in:
Buu Nguyen 2018-03-11 23:20:18 -07:00
parent 6426237bf9
commit 1701df4630
2 changed files with 4 additions and 5 deletions

View File

@ -2,10 +2,10 @@ class PjaxAdapter extends Adapter {
constructor(store) {
super(['jquery.pjax.js'], store)
$.pjax.defaults.timeout = 0 // no timeout
$(document)
.on('pjax:send', () => $(document).trigger(EVENT.REQ_START))
.on('pjax:start', () => $(document).trigger(EVENT.REQ_START))
.on('pjax:end', () => $(document).trigger(EVENT.REQ_END))
.on('pjax:timeout', (e) => e.preventDefault())
}
// @override
@ -75,7 +75,8 @@ class PjaxAdapter extends Adapter {
$.pjax({
// needs full path for pjax to work with Firefox as per cross-domain-content setting
url: location.protocol + '//' + location.host + path,
container: $pjaxContainer
container: $pjaxContainer,
timeout: 0 // global timeout doesn't seem to work, use this instead
})
}
else {

View File

@ -72,8 +72,6 @@ $(document).ready(() => {
.on(EVENT.LAYOUT_CHANGE, layoutChanged)
.on(EVENT.TOGGLE, layoutChanged)
.on(EVENT.LOC_CHANGE, () => tryLoadRepo())
// This seems to fix intermitten page reload #342
.on('pjax:reload', (e) => e.preventDefault())
$sidebar
.width(parseInt(store.get(STORE.WIDTH)))