From 9a6b9a0bbb40bfe4f6663206e7fdcf2641641a44 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 2 Aug 2019 11:44:31 +0200 Subject: [PATCH] don't reload filters, fixes #3225 --- static/js/mainPanel.js | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/static/js/mainPanel.js b/static/js/mainPanel.js index e94f700c..7460a3c8 100644 --- a/static/js/mainPanel.js +++ b/static/js/mainPanel.js @@ -23,8 +23,39 @@ pandora.ui.mainPanel = function() { .bindEvent({ pandora_finddocuments: function() { var previousUI = pandora.UI.getPrevious(); - if (!previousUI.document && ui._list == previousUI._list) { - that.replaceElement(1, pandora.$ui.documentPanel = pandora.ui.documentPanel()); + Ox.Log('FIND', 'handled in mainPanel', previousUI.item, previousUI._list) + if (!previousUI.document && ui._collection == previousUI._collection) { + pandora.$ui.list.reloadList(); + + // FIXME: why is this being handled _here_? + ui._documentFilterState.forEach(function(data, i) { + if (!Ox.isEqual(data.selected, previousUI._documentFilterState[i].selected)) { + pandora.$ui.documentFilters[i].options( + ui.showFilters ? { + selected: data.selected + } : { + _selected: data.selected, + selected: [] + } + ); + } + if (!Ox.isEqual(data.find, previousUI._documentFilterState[i].find)) { + if (!ui.showFilters) { + pandora.$ui.documentFilters[i].options({ + _selected: data.selected + }); + } + // we can call reloadList here, since the items function + // handles the hidden filters case without making requests + pandora.$ui.documentFilters[i].reloadList(); + } + }); + } else { + if (pandora.stayInItemView) { + pandora.stayInItemView = false; + } else { + that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel()); + } } }, pandora_document: function(data) {