use default sorter pref for resiliency
This commit is contained in:
parent
adef93c3ed
commit
944c44ffb8
|
@ -60,13 +60,14 @@ const sorter = (() => {
|
||||||
'disabled,desc, title,desc',
|
'disabled,desc, title,desc',
|
||||||
'disabled,desc, usercss,asc, title,desc',
|
'disabled,desc, usercss,asc, title,desc',
|
||||||
];
|
];
|
||||||
|
|
||||||
const splitRegex = /\s*,\s*/;
|
const splitRegex = /\s*,\s*/;
|
||||||
|
const ID = 'manage.newUI.sort';
|
||||||
|
const getPref = () => prefs.get(ID) || prefs.__defaults[ID];
|
||||||
|
|
||||||
let columns = 1;
|
let columns = 1;
|
||||||
|
|
||||||
onDOMready().then(() => {
|
onDOMready().then(() => {
|
||||||
prefs.subscribe('manage.newUI.sort', sorter.update);
|
prefs.subscribe(ID, sorter.update);
|
||||||
$('#sorter-help').onclick = showHelp;
|
$('#sorter-help').onclick = showHelp;
|
||||||
addOptions();
|
addOptions();
|
||||||
updateColumnCount();
|
updateColumnCount();
|
||||||
|
@ -112,13 +113,13 @@ const sorter = (() => {
|
||||||
});
|
});
|
||||||
renderBin.appendChild(container);
|
renderBin.appendChild(container);
|
||||||
select.appendChild(renderBin);
|
select.appendChild(renderBin);
|
||||||
select.value = prefs.get('manage.newUI.sort');
|
select.value = getPref();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
sort({styles}) {
|
sort({styles}) {
|
||||||
const sortBy = prefs.get('manage.newUI.sort').split(splitRegex);
|
const sortBy = getPref().split(splitRegex);
|
||||||
const len = sortBy.length;
|
const len = sortBy.length;
|
||||||
return styles.sort((a, b) => {
|
return styles.sort((a, b) => {
|
||||||
let types, direction;
|
let types, direction;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user