mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Merge branch 'main' into maryhipp/informational-popover
This commit is contained in:
commit
f4c895257a
@ -15,12 +15,9 @@ import {
|
|||||||
import { getValidControlNets } from 'features/controlNet/util/getValidControlNets';
|
import { getValidControlNets } from 'features/controlNet/util/getValidControlNets';
|
||||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import { map } from 'lodash-es';
|
import { map } from 'lodash-es';
|
||||||
import { Fragment, memo, useCallback } from 'react';
|
import { Fragment, memo, useCallback, useMemo } from 'react';
|
||||||
import { FaPlus } from 'react-icons/fa';
|
import { FaPlus } from 'react-icons/fa';
|
||||||
import {
|
import { useGetControlNetModelsQuery } from 'services/api/endpoints/models';
|
||||||
controlNetModelsAdapter,
|
|
||||||
useGetControlNetModelsQuery,
|
|
||||||
} from 'services/api/endpoints/models';
|
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
const selector = createSelector(
|
const selector = createSelector(
|
||||||
@ -53,16 +50,22 @@ const ParamControlNetCollapse = () => {
|
|||||||
const { controlNetsArray, activeLabel } = useAppSelector(selector);
|
const { controlNetsArray, activeLabel } = useAppSelector(selector);
|
||||||
const isControlNetDisabled = useFeatureStatus('controlNet').isFeatureDisabled;
|
const isControlNetDisabled = useFeatureStatus('controlNet').isFeatureDisabled;
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { firstModel } = useGetControlNetModelsQuery(undefined, {
|
const { data: controlnetModels } = useGetControlNetModelsQuery();
|
||||||
selectFromResult: (result) => {
|
|
||||||
const firstModel = result.data
|
const firstModel = useMemo(() => {
|
||||||
? controlNetModelsAdapter.getSelectors().selectAll(result.data)[0]
|
if (!controlnetModels || !Object.keys(controlnetModels.entities).length) {
|
||||||
: undefined;
|
return undefined;
|
||||||
return {
|
}
|
||||||
firstModel,
|
const firstModelId = Object.keys(controlnetModels.entities)[0];
|
||||||
};
|
|
||||||
},
|
if (!firstModelId) {
|
||||||
});
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstModel = controlnetModels.entities[firstModelId];
|
||||||
|
|
||||||
|
return firstModel ? firstModel : undefined;
|
||||||
|
}, [controlnetModels]);
|
||||||
|
|
||||||
const handleClickedAddControlNet = useCallback(() => {
|
const handleClickedAddControlNet = useCallback(() => {
|
||||||
if (!firstModel) {
|
if (!firstModel) {
|
||||||
|
Loading…
Reference in New Issue
Block a user