feat(ui): sort log namespaces

This commit is contained in:
psychedelicious 2024-08-20 21:08:05 +10:00
parent e4829f80af
commit 0792b9175e
3 changed files with 11 additions and 11 deletions

View File

@ -16,16 +16,16 @@ export const BASE_CONTEXT = {};
export const $logger = atom<Logger>(Roarr.child(BASE_CONTEXT));
export const zLogNamespace = z.enum([
'gallery',
'models',
'config',
'canvas',
'generation',
'workflows',
'system',
'config',
'events',
'queue',
'gallery',
'generation',
'metadata',
'models',
'system',
'queue',
'workflows',
]);
const zLogNamespacesArray = z.array(zLogNamespace);
export type LogNamespace = z.infer<typeof zLogNamespace>;

View File

@ -15,11 +15,11 @@ export const SettingsDeveloperLogNamespaces = memo(() => {
if (s.system.logNamespaces.length === 0) {
return EMPTY_ARRAY;
} else {
return s.system.logNamespaces.toSorted();
return s.system.logNamespaces;
}
});
const disabledLogNamespaces = useMemo(
() => difference(zLogNamespace.options, enabledLogNamespaces).toSorted(),
() => difference(zLogNamespace.options, enabledLogNamespaces),
[enabledLogNamespaces]
);

View File

@ -35,9 +35,9 @@ export const systemSlice = createSlice({
},
logNamespaceToggled: (state, action: PayloadAction<LogNamespace>) => {
if (state.logNamespaces.includes(action.payload)) {
state.logNamespaces = uniq(state.logNamespaces.filter((n) => n !== action.payload));
state.logNamespaces = uniq(state.logNamespaces.filter((n) => n !== action.payload)).toSorted();
} else {
state.logNamespaces = uniq([...state.logNamespaces, action.payload]);
state.logNamespaces = uniq([...state.logNamespaces, action.payload]).toSorted();
}
},
shouldAntialiasProgressImageChanged: (state, action: PayloadAction<boolean>) => {