client/posts: remember offset when opening/closing bulk editor

Fixes rr-#274
Squashed with commit "client/posts: make prevQuery a const"
This commit is contained in:
neobooru 2019-10-25 14:12:41 +02:00 committed by Shyam Sunder
parent 4f5ea9c5ed
commit eb49aea683

View file

@ -246,8 +246,10 @@ class PostsHeaderView extends events.EventTarget {
_navigate() {
this._autoCompleteControl.hide();
let parameters = {query: this._queryInputNode.value};
parameters.offset = parameters.query === this._ctx.parameters.query ?
this._ctx.parameters.offset : 0;
// convert falsy values to an empty string "" so that we can correctly compare with the current query
const prevQuery = this._ctx.parameters.query ? this._ctx.parameters.query : "";
parameters.offset = parameters.query === prevQuery ? this._ctx.parameters.offset : 0;
if (this._bulkTagEditor && this._bulkTagEditor.opened) {
parameters.tag = this._bulkTagEditor.value;
this._bulkTagEditor.blur();