From 9f1ea9d1c78089cb44a20f5a80425f68fb6a5ea0 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 27 Jun 2025 11:19:24 +1000 Subject: [PATCH] fix(ui): use existing GroupStatusMap type --- .../frontend/web/src/common/components/Picker/Picker.tsx | 9 +++------ .../web/src/features/lora/components/LoRASelect.tsx | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/invokeai/frontend/web/src/common/components/Picker/Picker.tsx b/invokeai/frontend/web/src/common/components/Picker/Picker.tsx index e3c0d35e10..d0e3271c31 100644 --- a/invokeai/frontend/web/src/common/components/Picker/Picker.tsx +++ b/invokeai/frontend/web/src/common/components/Picker/Picker.tsx @@ -201,7 +201,7 @@ type PickerProps = { /** * Initial state for group toggles. If provided, groups will start with these states instead of all being disabled. */ - initialGroupStates?: Record; + initialGroupStates?: GroupStatusMap; }; export type PickerContextState = { @@ -314,12 +314,9 @@ const flattenOptions = (options: OptionOrGroup[]): T[] => { return flattened; }; -type GroupStatusMap = Record; +export type GroupStatusMap = Record; -const useTogglableGroups = ( - options: OptionOrGroup[], - initialGroupStates?: Record -) => { +const useTogglableGroups = (options: OptionOrGroup[], initialGroupStates?: GroupStatusMap) => { const groupsWithOptions = useMemo(() => { const ids: string[] = []; for (const optionOrGroup of options) { diff --git a/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx b/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx index 4ab04783df..293acde364 100644 --- a/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx +++ b/invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx @@ -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 (