mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): clarify scheduler logic
- use full conditional syntax with `{}` - do not mutate `action.payload` in a reducer
This commit is contained in:
@ -24,14 +24,17 @@ const ParamScheduler = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedSchedulers.length === 0)
|
||||
if (selectedSchedulers.length === 0) {
|
||||
dispatch(setSelectedSchedulers([...SCHEDULER_ITEMS]));
|
||||
}
|
||||
|
||||
const schedulerFound = activeSchedulers.find(
|
||||
(activeSchedulers) => activeSchedulers.value === scheduler
|
||||
);
|
||||
if (!schedulerFound)
|
||||
|
||||
if (!schedulerFound) {
|
||||
dispatch(setScheduler(activeSchedulers[0].value as Scheduler));
|
||||
}
|
||||
}, [dispatch, selectedSchedulers, scheduler, activeSchedulers]);
|
||||
|
||||
const handleChange = useCallback(
|
||||
|
Reference in New Issue
Block a user