fix(ui): use existing GroupStatusMap type

This commit is contained in:
psychedelicious
2025-06-27 11:19:24 +10:00
parent 571d286506
commit 9f1ea9d1c7
2 changed files with 5 additions and 7 deletions

View File

@@ -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) {

View File

@@ -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 (