Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(webv2): address adversarial review findings on the video panel shell

Lincoln Steinfd8f8e216b9f
diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
index 40f6abf02f..34026ff3b3 100644
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
@@ -372,6 +372,8 @@ export interface VideoModelPolicy {
isSupported: boolean;
modes: readonly VideoGenerationMode[];
pixelMultiple: number;
+ /** The family's floor for the steps control (validation enforces it too). */
+ minSteps: number;
aspectRatioOptions: readonly VideoAspectRatioId[];
targetResolutions: readonly VideoTargetResolutionOption[];
frames: VideoFramesPolicy;
@@ -406,6 +408,7 @@ export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings
fps: config.fps,
frames: config.frames,
isSupported: model ? isSupportedVideoModel(model) : false,
+ minSteps: config.minSteps,
modes: config.modes,
pixelMultiple: config.pixelMultiple,
prompt: getVideoPromptPolicy(model, settings),
diff --git a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
index 0c3d9e9d23..a662ff307a 100644
--- a/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/features/video/ui/VideoWidgetView.tsx
@@ -3,7 +3,7 @@ import type { VideoWidgetValues } from '@features/video/core/types';
import { createListCollection, HStack, NumberInput, Stack, Switch, Text } from '@chakra-ui/react';
import { GenerationSettingsSection } from '@features/generation/components';
-import { isMainModelConfig, SEED_MAX } from '@features/generation/settings';
+import { isMainModelConfig, sanitizeBatchCount, SEED_MAX } from '@features/generation/settings';
import { ensureModelsLoaded, useModelsSelector } from '@features/models';
import { ModelSelect } from '@features/models/react';
import { getVideoDurationSeconds, invertVideoAspectRatioId } from '@features/video/core/dimensions';
@@ -68,7 +68,13 @@ const VideoModelReconciler = ({
return;
}
- patchValues({ ...values }, 'system');
+ // When the store fails normalization wholesale (first open: the topbar
+ // Iterations field may already have patched `batchCount` into an
+ // otherwise-empty widget store), seeding the defaults must not wipe that
+ // one pre-open edit.
+ const batchCount = normalized ? values.batchCount : sanitizeBatchCount(rawValues.batchCount ?? values.batchCount);
+
+ patchValues({ ...values, batchCount }, 'system');
});
return null;
@@ -342,7 +348,7 @@ export const VideoWidgetView = () => {
<SliderNumberField
ariaLabel={t('widgets.video.steps')}
max={100}
- min={1}
+ min={policy.minSteps}
numberInputMax={500}
step={1}
value={values.steps}
diff --git a/invokeai/frontend/webv2/src/workbench/invocation.test.ts b/invokeai/frontend/webv2/src/workbench/invocation.test.ts
index 48550bb45e..2fba396b8c 100644
--- a/invokeai/frontend/webv2/src/workbench/invocation.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/invocation.test.ts
@@ -523,3 +523,30 @@ describe('submitResolvedInvocation', () => {
expect(submitResolved).not.toHaveBeenCalled();
});
});
+
+describe('resolveInvocationRoute — video destination compatibility', () => {
+ it('blocks the canvas destination for a video source and allows the gallery', () => {
+ const state = createInitialWorkbenchState();
+ const project = state.projects.find((candidate) => candidate.id === state.activeProjectId)!;
+ const input = getInvocationRouteInput(project);
+ const canvasRoute: InvocationRoute = {
+ destination: 'canvas',
+ destinationLocked: false,
+ sourceId: 'video',
+ sourceLocked: false,
+ };
+
+ // A canvas-routed video run would complete with the output appearing
+ // nowhere (staging is image-based; only gallery-destined videos board).
+ const blocked = resolveInvocationRouteInput(input, 'global', canvasRoute);
+
+ expect(blocked.destinationValid).toBe(false);
+ expect(blocked.validationReasons).toContain(
+ 'Video results can only be sent to the Gallery. Switch the destination to Gallery.'
+ );
+
+ expect(
+ resolveInvocationRouteInput(input, 'global', { ...canvasRoute, destination: 'gallery' }).destinationValid
+ ).toBe(true);
+ });
+});
diff --git a/invokeai/frontend/webv2/src/workbench/invocation.ts b/invokeai/frontend/webv2/src/workbench/invocation.ts
index 8f20451fdc..868c9b1927 100644
--- a/invokeai/frontend/webv2/src/workbench/invocation.ts
+++ b/invokeai/frontend/webv2/src/workbench/invocation.ts
@@ -261,10 +261,18 @@ export const resolveInvocationRouteInput = (
}
const sourceValid = validationReasons.length === 0;
- const destinationValid = isResultDestinationAvailable(destination);
-
- if (!destinationValid) {
+ // A video result is structurally undeliverable to the Canvas: staging is
+ // image-based and the queue runtime only boards gallery-destined videos, so
+ // a canvas-routed video run would complete with the output appearing
+ // nowhere. Block it instead of letting the result vanish.
+ const destinationCompatible = !(sourceId === 'video' && destination === 'canvas');
+ const destinationAvailable = isResultDestinationAvailable(destination);
+ const destinationValid = destinationAvailable && destinationCompatible;
+
+ if (!destinationAvailable) {
validationReasons.push(`${getDestinationLabel(destination)} is not an available result destination.`);
+ } else if (!destinationCompatible) {
+ validationReasons.push('Video results can only be sent to the Gallery. Switch the destination to Gallery.');
}
return {