mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
UX: Maintain scroll position when refreshing search results #4985
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -487,19 +487,24 @@ export default {
|
||||
refresh(props) {
|
||||
this.updateSettings(props);
|
||||
|
||||
// Do not refresh results if the view is already loading
|
||||
// or should not be listening for events.
|
||||
if (this.loading || !this.listen) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Leaving "loading" untouched here avoids flickering when refreshing the results, which might lead to a
|
||||
smoother experience. If it doesn't cause any problems or unwanted side effects, this line can be removed.
|
||||
// Make sure enough results are loaded to maintain the scroll position.
|
||||
if (this.page > 2) {
|
||||
this.page = this.page - 1;
|
||||
} else {
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
*/
|
||||
this.page = 0;
|
||||
// Flag results as dirty and incomplete to force a refresh.
|
||||
this.dirty = true;
|
||||
this.complete = false;
|
||||
|
||||
// Enable infinite scrolling if it was disabled.
|
||||
this.scrollDisabled = false;
|
||||
|
||||
this.loadMore(true);
|
||||
|
||||
@@ -995,19 +995,25 @@ export default {
|
||||
refresh(props) {
|
||||
this.updateSettings(props);
|
||||
|
||||
// Do not refresh results if the view is already loading
|
||||
// or should not be listening for events.
|
||||
if (this.loading || !this.listen) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Leaving "loading" untouched here avoids flickering when refreshing the results, which might lead to a
|
||||
smoother experience. If it doesn't cause any problems or unwanted side effects, this line can be removed.
|
||||
// Make sure enough results are loaded to maintain the scroll position.
|
||||
if (this.page > 2) {
|
||||
this.page = this.page - 1;
|
||||
} else {
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
*/
|
||||
this.page = 0;
|
||||
// Flag results as dirty to force a refresh.
|
||||
this.dirty = true;
|
||||
|
||||
// Enable infinite scrolling if it was disabled.
|
||||
this.scrollDisabled = false;
|
||||
|
||||
this.loadMore();
|
||||
},
|
||||
create() {
|
||||
|
||||
@@ -646,18 +646,23 @@ export default {
|
||||
refresh(props) {
|
||||
this.updateSettings(props);
|
||||
|
||||
// Do not refresh results if the view is already loading
|
||||
// or should not be listening for events.
|
||||
if (this.loading || !this.listen) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Leaving "loading" untouched here avoids flickering when refreshing the results, which might lead to a
|
||||
smoother experience. If it doesn't cause any problems or unwanted side effects, this line can be removed.
|
||||
// Make sure enough results are loaded to maintain the scroll position.
|
||||
if (this.page > 2) {
|
||||
this.page = this.page - 1;
|
||||
} else {
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
*/
|
||||
this.page = 0;
|
||||
// Flag results as dirty to force a refresh.
|
||||
this.dirty = true;
|
||||
|
||||
// Enable infinite scrolling if it was disabled.
|
||||
this.scrollDisabled = false;
|
||||
|
||||
this.loadMore();
|
||||
|
||||
@@ -421,14 +421,16 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Leaving "loading" untouched here avoids flickering when refreshing the results, which might lead to a
|
||||
smoother experience. If it doesn't cause any problems or unwanted side effects, this line can be removed.
|
||||
// Make sure enough results are loaded to maintain the scroll position.
|
||||
if (this.page > 2) {
|
||||
this.page = this.page - 1;
|
||||
} else {
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
*/
|
||||
this.page = 0;
|
||||
// Flag results as dirty to force a refresh.
|
||||
this.dirty = true;
|
||||
|
||||
this.search();
|
||||
},
|
||||
getPathAsString() {
|
||||
|
||||
@@ -535,14 +535,17 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Leaving "loading" untouched here avoids flickering when refreshing the results, which might lead to a
|
||||
smoother experience. If it doesn't cause any problems or unwanted side effects, this line can be removed.
|
||||
// Make sure enough results are loaded to maintain the scroll position.
|
||||
if (this.page > 2) {
|
||||
this.page = this.page - 1;
|
||||
} else {
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
*/
|
||||
this.page = 0;
|
||||
// Flag results as dirty to force a refresh.
|
||||
this.dirty = true;
|
||||
|
||||
// Enable infinite scrolling if it was disabled.
|
||||
this.scrollDisabled = false;
|
||||
|
||||
this.loadMore();
|
||||
|
||||
@@ -678,18 +678,23 @@ export default {
|
||||
refresh(props) {
|
||||
this.updateSettings(props);
|
||||
|
||||
// Do not refresh results if the view is already loading
|
||||
// or should not be listening for events.
|
||||
if (this.loading || !this.active || !this.listen) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Leaving "loading" untouched here avoids flickering when refreshing the results, which might lead to a
|
||||
smoother experience. If it doesn't cause any problems or unwanted side effects, this line can be removed.
|
||||
// Make sure enough results are loaded to maintain the scroll position.
|
||||
if (this.page > 2) {
|
||||
this.page = this.page - 1;
|
||||
} else {
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
*/
|
||||
this.page = 0;
|
||||
// Flag results as dirty to force a refresh.
|
||||
this.dirty = true;
|
||||
|
||||
// Enable infinite scrolling if it was disabled.
|
||||
this.scrollDisabled = false;
|
||||
|
||||
this.loadMore();
|
||||
|
||||
@@ -620,19 +620,24 @@ export default {
|
||||
refresh(props) {
|
||||
this.updateSettings(props);
|
||||
|
||||
// Do not refresh results if the view is already loading
|
||||
// or should not be listening for events.
|
||||
if (this.loading || !this.listen) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Leaving "loading" untouched here avoids flickering when refreshing the results, which might lead to a
|
||||
smoother experience. If it doesn't cause any problems or unwanted side effects, this line can be removed.
|
||||
// Make sure enough results are loaded to maintain the scroll position.
|
||||
if (this.page > 2) {
|
||||
this.page = this.page - 1;
|
||||
} else {
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
*/
|
||||
this.page = 0;
|
||||
// Flag results as dirty and incomplete to force a refresh.
|
||||
this.dirty = true;
|
||||
this.complete = false;
|
||||
|
||||
// Enable infinite scrolling if it was disabled.
|
||||
this.scrollDisabled = false;
|
||||
|
||||
this.loadMore(true);
|
||||
|
||||
Reference in New Issue
Block a user