fix too many images getting pre-loaded on filter change
This commit is contained in:
parent
00e17b7bb0
commit
3e33af7d1d
6 changed files with 46 additions and 17 deletions
|
@ -113,12 +113,12 @@ Vue.use(VueFilters);
|
|||
Vue.use(Components);
|
||||
Vue.use(Dialogs);
|
||||
|
||||
window.popStateDetected = false;
|
||||
window.backwardsNavigationDetected = false;
|
||||
window.addEventListener("popstate", (event) => {
|
||||
window.popStateDetected = true;
|
||||
// give components time to react to popStateDetected in `created` or '$route'-watcher
|
||||
window.backwardsNavigationDetected = true;
|
||||
// give components time to react to backwardsNavigationDetected in `created` or '$route'-watcher
|
||||
setTimeout(() => {
|
||||
window.popStateDetected = false;
|
||||
window.backwardsNavigationDetected = false;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -301,9 +301,6 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
if (!window.popStateDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
this.search();
|
||||
|
||||
this.subscriptions.push(Event.subscribe("albums", (ev, data) => this.onUpdate(ev, data)));
|
||||
|
@ -568,6 +565,15 @@ export default {
|
|||
return params;
|
||||
},
|
||||
search() {
|
||||
/**
|
||||
* re-creating the last scroll-position should only ever happen when using
|
||||
* back-navigation. We therefore reset the remembered scroll-position
|
||||
* in any other scenario
|
||||
*/
|
||||
if (!window.backwardsNavigationDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
|
||||
this.scrollDisabled = true;
|
||||
|
||||
// Don't query the same data more than once
|
||||
|
|
|
@ -204,9 +204,6 @@ export default {
|
|||
},
|
||||
},
|
||||
created() {
|
||||
if (!window.popStateDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
this.search();
|
||||
|
||||
this.subscriptions.push(Event.subscribe("labels", (ev, data) => this.onUpdate(ev, data)));
|
||||
|
@ -506,6 +503,15 @@ export default {
|
|||
this.loadMore();
|
||||
},
|
||||
search() {
|
||||
/**
|
||||
* re-creating the last scroll-position should only ever happen when using
|
||||
* back-navigation. We therefore reset the remembered scroll-position
|
||||
* in any other scenario
|
||||
*/
|
||||
if (!window.backwardsNavigationDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
|
||||
this.scrollDisabled = true;
|
||||
|
||||
// Don't query the same data more than once
|
||||
|
|
|
@ -249,9 +249,6 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
if (!window.popStateDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
this.search();
|
||||
|
||||
this.subscriptions.push(Event.subscribe("subjects", (ev, data) => this.onUpdate(ev, data)));
|
||||
|
@ -616,6 +613,15 @@ export default {
|
|||
this.loadMore();
|
||||
},
|
||||
search() {
|
||||
/**
|
||||
* re-creating the last scroll-position should only ever happen when using
|
||||
* back-navigation. We therefore reset the remembered scroll-position
|
||||
* in any other scenario
|
||||
*/
|
||||
if (!window.backwardsNavigationDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
|
||||
this.scrollDisabled = true;
|
||||
|
||||
// Don't query the same data more than once
|
||||
|
|
|
@ -444,7 +444,12 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!window.popStateDetected) {
|
||||
/**
|
||||
* re-creating the last scroll-position should only ever happen when using
|
||||
* back-navigation. We therefore reset the remembered scroll-position
|
||||
* in any other scenario
|
||||
*/
|
||||
if (!window.backwardsNavigationDetected) {
|
||||
window.localStorage.removeItem("last_opened_photo");
|
||||
this.setOffset(0);
|
||||
}
|
||||
|
|
|
@ -190,9 +190,6 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
if (!window.popStateDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
const token = this.$route.params.token;
|
||||
|
||||
if (this.$session.hasToken(token)) {
|
||||
|
@ -385,6 +382,15 @@ export default {
|
|||
return params;
|
||||
},
|
||||
search() {
|
||||
/**
|
||||
* re-creating the last scroll-position should only ever happen when using
|
||||
* back-navigation. We therefore reset the remembered scroll-position
|
||||
* in any other scenario
|
||||
*/
|
||||
if (!window.backwardsNavigationDetected) {
|
||||
this.setOffset(0);
|
||||
}
|
||||
|
||||
this.scrollDisabled = true;
|
||||
|
||||
// Don't query the same data more than once
|
||||
|
|
Loading…
Reference in a new issue