Fix updateSort part deux
This commit is contained in:
parent
cedf2fd691
commit
5eeb0c82ea
|
@ -155,9 +155,9 @@ function filterOnChange({target: el, forceRefilter}) {
|
|||
});
|
||||
if (installed) {
|
||||
reapplyFilter();
|
||||
}
|
||||
sorter().updateSort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function filterAndAppend({entry, container}) {
|
||||
|
|
|
@ -144,18 +144,23 @@ const sorter = (() => {
|
|||
}
|
||||
|
||||
function updateSort() {
|
||||
getStylesSafe().then(styles => {
|
||||
const renderBin = document.createDocumentFragment();
|
||||
const entries = sortStyles(styles);
|
||||
if (!installed) return;
|
||||
const current = [...installed.children];
|
||||
const isDiffSort = entries.length !== current.length ||
|
||||
current.find((entry, index) => entry.id !== entries[index].id);
|
||||
const sorted = sortStyles({
|
||||
styles: current.map(entry => ({
|
||||
entry,
|
||||
name: entry.styleNameLowerCase,
|
||||
style: BG.cachedStyles.byId.get(entry.styleId),
|
||||
}))
|
||||
});
|
||||
const isDiffSort = sorted.length !== current.length ||
|
||||
current.find((entry, index) => entry !== sorted[index].entry);
|
||||
if (isDiffSort) {
|
||||
entries.forEach(entry => renderBin.appendChild(entry));
|
||||
const renderBin = document.createDocumentFragment();
|
||||
sorted.forEach(({entry}) => renderBin.appendChild(entry));
|
||||
installed.appendChild(renderBin);
|
||||
updateStripes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function manageSort(event) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user