Don't hide old item search results if input updates without change
This commit is contained in:
parent
60451e8f78
commit
4af4c8e1b9
1 changed files with 4 additions and 6 deletions
10
items.js
10
items.js
|
@ -90,10 +90,6 @@ function init() {
|
|||
|
||||
// updates the current search state from the search query input boxes
|
||||
function updateSearch() {
|
||||
// hide old search results
|
||||
itemListFooter.innerText = '';
|
||||
for (const itemEntry of itemEntries) itemEntry.style.display = 'none';
|
||||
|
||||
// compile query expressions, aborting if nothing has changed or either fails to compile
|
||||
const changed = searchFilterField.compile() | searchSortField.compile();
|
||||
if (!changed || searchFilterField.output === null || searchSortField.output === null) return;
|
||||
|
@ -103,6 +99,10 @@ function init() {
|
|||
+ `?f=${encodeURIComponent(searchFilterField.value)}&s=${encodeURIComponent(searchSortField.value)}`;
|
||||
window.history.pushState({ path: newUrl }, '', newUrl);
|
||||
|
||||
// hide old search results
|
||||
itemListFooter.innerText = '';
|
||||
for (const itemEntry of itemEntries) itemEntry.style.display = 'none';
|
||||
|
||||
// index and sort search results
|
||||
const searchResults = [];
|
||||
try {
|
||||
|
@ -172,8 +172,6 @@ function init() {
|
|||
for (const entryStr of window.location.search.substring(1).split('&')) {
|
||||
const ndx = entryStr.indexOf('=');
|
||||
if (ndx !== -1) {
|
||||
console.log(entryStr.substring(0, ndx));
|
||||
console.log(entryStr.substring(ndx + 1));
|
||||
switch (entryStr.substring(0, ndx)) {
|
||||
case 'f':
|
||||
searchFilterField.field.value = decodeURIComponent(entryStr.substring(ndx + 1));
|
||||
|
|
Loading…
Reference in a new issue