mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-12 13:25:22 -05:00
fix(ui): use existing GroupStatusMap type
This commit is contained in:
@@ -201,7 +201,7 @@ type PickerProps<T extends object> = {
|
||||
/**
|
||||
* Initial state for group toggles. If provided, groups will start with these states instead of all being disabled.
|
||||
*/
|
||||
initialGroupStates?: Record<string, boolean>;
|
||||
initialGroupStates?: GroupStatusMap;
|
||||
};
|
||||
|
||||
export type PickerContextState<T extends object> = {
|
||||
@@ -314,12 +314,9 @@ const flattenOptions = <T extends object>(options: OptionOrGroup<T>[]): T[] => {
|
||||
return flattened;
|
||||
};
|
||||
|
||||
type GroupStatusMap = Record<string, boolean>;
|
||||
export type GroupStatusMap = Record<string, boolean>;
|
||||
|
||||
const useTogglableGroups = <T extends object>(
|
||||
options: OptionOrGroup<T>[],
|
||||
initialGroupStates?: Record<string, boolean>
|
||||
) => {
|
||||
const useTogglableGroups = <T extends object>(options: OptionOrGroup<T>[], initialGroupStates?: GroupStatusMap) => {
|
||||
const groupsWithOptions = useMemo(() => {
|
||||
const ids: string[] = [];
|
||||
for (const optionOrGroup of options) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { FormControl, FormLabel } from '@invoke-ai/ui-library';
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
|
||||
import type { GroupStatusMap } from 'common/components/Picker/Picker';
|
||||
import { useRelatedGroupedModelCombobox } from 'common/hooks/useRelatedGroupedModelCombobox';
|
||||
import { loraAdded, selectLoRAsSlice } from 'features/controlLayers/store/lorasSlice';
|
||||
import { selectBase } from 'features/controlLayers/store/paramsSlice';
|
||||
@@ -69,7 +70,7 @@ const LoRASelect = () => {
|
||||
const groupId = API_BASE_MODELS.includes(currentBaseModel) ? 'api' : currentBaseModel;
|
||||
|
||||
// Return a map with only the current base model group enabled
|
||||
return { [groupId]: true };
|
||||
return { [groupId]: true } satisfies GroupStatusMap;
|
||||
}, [currentBaseModel]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user