Skip to content

Commit 9f1ea9d

Browse files
fix(ui): use existing GroupStatusMap type
1 parent 571d286 commit 9f1ea9d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

invokeai/frontend/web/src/common/components/Picker/Picker.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ type PickerProps<T extends object> = {
201201
/**
202202
* Initial state for group toggles. If provided, groups will start with these states instead of all being disabled.
203203
*/
204-
initialGroupStates?: Record<string, boolean>;
204+
initialGroupStates?: GroupStatusMap;
205205
};
206206

207207
export type PickerContextState<T extends object> = {
@@ -314,12 +314,9 @@ const flattenOptions = <T extends object>(options: OptionOrGroup<T>[]): T[] => {
314314
return flattened;
315315
};
316316

317-
type GroupStatusMap = Record<string, boolean>;
317+
export type GroupStatusMap = Record<string, boolean>;
318318

319-
const useTogglableGroups = <T extends object>(
320-
options: OptionOrGroup<T>[],
321-
initialGroupStates?: Record<string, boolean>
322-
) => {
319+
const useTogglableGroups = <T extends object>(options: OptionOrGroup<T>[], initialGroupStates?: GroupStatusMap) => {
323320
const groupsWithOptions = useMemo(() => {
324321
const ids: string[] = [];
325322
for (const optionOrGroup of options) {

invokeai/frontend/web/src/features/lora/components/LoRASelect.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { FormControl, FormLabel } from '@invoke-ai/ui-library';
22
import { createSelector } from '@reduxjs/toolkit';
33
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
44
import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover';
5+
import type { GroupStatusMap } from 'common/components/Picker/Picker';
56
import { useRelatedGroupedModelCombobox } from 'common/hooks/useRelatedGroupedModelCombobox';
67
import { loraAdded, selectLoRAsSlice } from 'features/controlLayers/store/lorasSlice';
78
import { selectBase } from 'features/controlLayers/store/paramsSlice';
@@ -69,7 +70,7 @@ const LoRASelect = () => {
6970
const groupId = API_BASE_MODELS.includes(currentBaseModel) ? 'api' : currentBaseModel;
7071

7172
// Return a map with only the current base model group enabled
72-
return { [groupId]: true };
73+
return { [groupId]: true } satisfies GroupStatusMap;
7374
}, [currentBaseModel]);
7475

7576
return (

0 commit comments

Comments
 (0)