fix(ui): create all scheduler constants up-front

This commit is contained in:
psychedelicious
2023-06-18 18:49:10 +10:00
parent f1a8b9daee
commit 150059f704
3 changed files with 22 additions and 20 deletions

View File

@ -1,4 +1,4 @@
import { SCHEDULER_ITEMS, Scheduler } from 'app/constants';
import { SCHEDULER_NAMES, Scheduler } from 'app/constants';
import { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAIMantineSelect from 'common/components/IAIMantineSelect';
@ -25,7 +25,7 @@ const ParamScheduler = () => {
useEffect(() => {
if (selectedSchedulers.length === 0) {
dispatch(setSelectedSchedulers([...SCHEDULER_ITEMS]));
dispatch(setSelectedSchedulers(SCHEDULER_NAMES));
}
const schedulerFound = activeSchedulers.find(

View File

@ -1,4 +1,4 @@
import { NUMPY_RAND_MAX, SCHEDULER_ITEMS } from 'app/constants';
import { NUMPY_RAND_MAX, SCHEDULER_NAMES_AS_CONST } from 'app/constants';
import { z } from 'zod';
/**
@ -73,7 +73,7 @@ export const isValidCfgScale = (val: unknown): val is CfgScaleParam =>
/**
* Zod schema for scheduler parameter
*/
export const zScheduler = z.enum(SCHEDULER_ITEMS);
export const zScheduler = z.enum(SCHEDULER_NAMES_AS_CONST);
/**
* Type alias for scheduler parameter, inferred from its zod schema
*/