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