Skip to content

Commit 23bd8e6

Browse files
author
Attila Cseh
committed
rendering global controls in all tabs fixed
1 parent f7200e7 commit 23bd8e6

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

invokeai/frontend/web/src/features/controlLayers/store/paramsSlice.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,11 @@ export const paramsSliceReducer = (state: ParamsState, action: UnknownAction): P
651651
...state,
652652
upscaling: instanceParamsFragment.reducer(state.upscaling, action),
653653
};
654+
case 'video':
655+
return {
656+
...state,
657+
upscaling: instanceParamsFragment.reducer(state.video, action),
658+
};
654659
}
655660
};
656661

@@ -687,6 +692,7 @@ export const paramsSliceConfig: SliceConfig<typeof paramsSlice> = {
687692
generate: { ...state },
688693
canvases: { [canvasParams.canvasId]: canvasParams },
689694
upscaling: { ...state },
695+
video: { ...state },
690696
};
691697
}
692698

@@ -695,13 +701,11 @@ export const paramsSliceConfig: SliceConfig<typeof paramsSlice> = {
695701
},
696702
};
697703

704+
const initialInstanceParamsState = getInitialInstanceParamsState();
705+
698706
export const selectActiveParams = (state: RootState) => {
699707
const tab = selectActiveTab(state);
700708
const canvasId = selectActiveCanvasId(state);
701-
assert(
702-
tab === 'generate' || tab === 'canvas' || tab === 'upscaling',
703-
`Unsupported tab ${tab} for params slice selector`
704-
);
705709

706710
switch (tab) {
707711
case 'generate':
@@ -713,7 +717,12 @@ export const selectActiveParams = (state: RootState) => {
713717
}
714718
case 'upscaling':
715719
return state.params.upscaling;
720+
case 'video':
721+
return state.params.video;
716722
}
723+
724+
// Fallback for global controls
725+
return initialInstanceParamsState;
717726
};
718727

719728
const buildActiveParamsSelector =

invokeai/frontend/web/src/features/controlLayers/store/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,9 @@ const zPositivePromptHistory = z
687687

688688
type EnrichedPayload<T, P> = P extends undefined ? T : T & { value: P };
689689

690-
export const isParamsTab = (tab: TabName) => tab === 'generate' || tab === 'canvas' || tab === 'upscaling';
691-
type ParamsTabName = 'generate' | 'canvas' | 'upscaling';
690+
export const isParamsTab = (tab: TabName) =>
691+
tab === 'generate' || tab === 'canvas' || tab === 'upscaling' || tab === 'video';
692+
type ParamsTabName = 'generate' | 'canvas' | 'upscaling' | 'video';
692693
export type ParamsEnrichedPayload<P = undefined> = EnrichedPayload<{ tab: ParamsTabName; canvasId: string }, P>;
693694
export type ParamsPayloadAction<P = undefined> = PayloadAction<ParamsEnrichedPayload<P>>;
694695

@@ -751,6 +752,7 @@ export const zParamsState = z.object({
751752
generate: zInstanceParams,
752753
canvases: z.record(z.string(), zCanvasInstanceParams),
753754
upscaling: zInstanceParams,
755+
video: zInstanceParams,
754756
});
755757
export type ParamsState = z.infer<typeof zParamsState>;
756758

@@ -816,6 +818,7 @@ export const getInitialParamsState = (): ParamsState => ({
816818
generate: getInitialInstanceParamsState(),
817819
canvases: {},
818820
upscaling: getInitialInstanceParamsState(),
821+
video: getInitialInstanceParamsState(),
819822
});
820823

821824
const zInpaintMasks = z.object({

0 commit comments

Comments
 (0)