Fix debounce of updateSort

This commit is contained in:
Rob Garrison 2017-12-23 01:46:26 -06:00
parent edf44fbdf3
commit 01af7abb96
4 changed files with 11 additions and 13 deletions

View File

@ -156,7 +156,7 @@ function filterOnChange({target: el, forceRefilter}) {
if (installed) { if (installed) {
reapplyFilter(); reapplyFilter();
} }
updateSort(); debounce(updateSort);
} }

View File

@ -451,7 +451,7 @@ function handleUpdate(style, {reason, method} = {}) {
handleUpdateInstalled(entry, reason); handleUpdateInstalled(entry, reason);
} }
filterAndAppend({entry}); filterAndAppend({entry});
updateSort(); debounce(updateSort);
if (!entry.matches('.hidden') && reason !== 'import') { if (!entry.matches('.hidden') && reason !== 'import') {
animateElement(entry); animateElement(entry);
scrollElementIntoView(entry); scrollElementIntoView(entry);

View File

@ -135,19 +135,17 @@ function sortStyles({styles, parser}) {
function manageSort(event) { function manageSort(event) {
event.preventDefault(); event.preventDefault();
prefs.set('manage.newUI.sort', this.value); prefs.set('manage.newUI.sort', this.value);
updateSort(); debounce(updateSort);
} }
function updateSort() { function updateSort() {
debounce(() => { const renderBin = document.createDocumentFragment();
const renderBin = document.createDocumentFragment(); const entries = sortStyles({parser: 'entry'});
const entries = sortStyles({parser: 'entry'}); for (const entry of entries) {
for (const entry of entries) { renderBin.appendChild(entry);
renderBin.appendChild(entry); }
} installed.appendChild(renderBin);
installed.appendChild(renderBin); updateStripes();
updateStripes();
});
} }
function showSortHelp(event) { function showSortHelp(event) {

View File

@ -144,7 +144,7 @@ function reportUpdateState(state, style, details) {
} }
if (filtersSelector.hide) { if (filtersSelector.hide) {
filterAndAppend({entry}); filterAndAppend({entry});
updateSort(); debounce(updateSort);
} }
} }