mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-17 09:01:48 -05:00
chore(ui): "controlnet" -> "controladapters"
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user