chore(ui): "controlnet" -> "controladapters"

This commit is contained in:
psychedelicious
2023-10-06 18:56:25 +11:00
parent ba4616ff89
commit b57ebe52e4
86 changed files with 153 additions and 649 deletions

View File

@@ -0,0 +1,29 @@
import { createSelector } from '@reduxjs/toolkit';
import { stateSelector } from 'app/store/store';
import { useMemo } from 'react';
import { selectControlAdapterById } from '../store/controlAdaptersSlice';
import { useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import { isControlNet } from '../store/types';
export const useControlAdapterControlMode = (id: string) => {
const selector = useMemo(
() =>
createSelector(
stateSelector,
({ controlAdapters }) => {
const ca = selectControlAdapterById(controlAdapters, id);
if (ca && isControlNet(ca)) {
return ca.controlMode;
}
return undefined;
},
defaultSelectorOptions
),
[id]
);
const controlMode = useAppSelector(selector);
return controlMode;
};