Skip to content

Commit

Permalink
Fix: search filter
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Oct 23, 2021
1 parent 7665d67 commit f7c786f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion scripts/dashboard.js
Expand Up @@ -18,7 +18,8 @@ searchFilter.on('change', () => {
loader = createInfiniteLoader({
root: container,
createElement: createTabGroupDiv,
getSome: lastDoc => tabalanche.getSomeTabGroups(lastDoc && [lastDoc.created, lastDoc._id]),
getSome: lastDoc => tabalanche.getSomeTabGroups(
lastDoc && [lastDoc.created, lastDoc._id], searchFilter),
key: doc => doc.created,
id: doc => doc._id
});
Expand Down
7 changes: 5 additions & 2 deletions scripts/search-filter.js
Expand Up @@ -13,12 +13,15 @@ function createSearchFilter({
buildRules();

if (el.form) {
el.form.addEventListener('reset', updateValue);
el.form.addEventListener('reset', () => setTimeout(updateValue));
}
if (updateAt === 'change' || updateAt === 'input') {
el.addEventListener(updateAt, updateValue);
} else if (updateAt === 'submit') {
el.form.addEventListener('submit', updateValue);
el.form.addEventListener('submit', e => {
e.preventDefault();
updateValue();
});
} else {
throw new Error(`invalid updateAt: ${updateAt}`);
}
Expand Down

0 comments on commit f7c786f

Please sign in to comment.