From eb49aea683a64f905965b58f6f81c348a4aa0e99 Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Fri, 25 Oct 2019 14:12:41 +0200 Subject: [PATCH] client/posts: remember offset when opening/closing bulk editor Fixes rr-#274 Squashed with commit "client/posts: make prevQuery a const" --- client/js/views/posts_header_view.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/js/views/posts_header_view.js b/client/js/views/posts_header_view.js index 6b697c4..9ba09c9 100644 --- a/client/js/views/posts_header_view.js +++ b/client/js/views/posts_header_view.js @@ -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();