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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): raise the side panel minimum width to 350px
joshistoast6a85e43c348f
diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsxindex 33f604a152..a134948309 100644--- a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetFrames.tsx@@ -16,6 +16,7 @@ import { useFocusRegionProps } from '@workbench/focusRegions';import { openWorkbenchSettings } from '@workbench/settings/settingsDialogStore';import { resolveWidgetInstanceLabel } from '@workbench/widgetLabels';import { useActiveProjectSelector, useWorkbenchCommands } from '@workbench/WorkbenchContext';+import { getPanelSizeBounds } from '@workbench/workbenchState';import { SettingsIcon } from 'lucide-react';import {useCallback,@@ -32,21 +33,9 @@ import { WidgetIdentityIcon } from './WidgetIdentityIcon';import { WidgetSourceLockBadge } from './WidgetSourceLockBadge';const PANEL_SIZE_STEP_PX = 16;-const MIN_PANEL_SIZE_PX = 180;-const MAX_PANEL_SIZE_PX = 520;-const MIN_BOTTOM_PANEL_SIZE_PX = 96;-const MAX_BOTTOM_PANEL_SIZE_PX = 420;const RESIZE_HANDLE_HOVER_PROPS = { bg: 'accent.solid', opacity: 0.45 };const RESIZE_HANDLE_FOCUS_PROPS = { bg: 'accent.solid', opacity: 0.65, outline: '2px solid {colors.accent.solid}' };-const getPanelSizeBounds = (region: WidgetRegion): { max: number; min: number } => {- if (region === 'bottom') {- return { max: MAX_BOTTOM_PANEL_SIZE_PX, min: MIN_BOTTOM_PANEL_SIZE_PX };- }-- return { max: MAX_PANEL_SIZE_PX, min: MIN_PANEL_SIZE_PX };-};-const clampSize = (region: WidgetRegion, sizePx: number): number => {const { max, min } = getPanelSizeBounds(region);@@ -70,7 +59,9 @@ export const WidgetPanelFrame = ({const [dragSizePx, setDragSizePx] = useState<number | null>(null);const isLeft = region === 'left';const isBottom = region === 'bottom';- const displaySizePx = dragSizePx ?? regionState.sizePx;+ // Clamped at render, not just on commit, so a persisted size from before a+ // bounds change heals on screen immediately instead of on the next resize.+ const displaySizePx = clampSize(region, dragSizePx ?? regionState.sizePx);const { max: maxPanelSizePx, min: minPanelSizePx } = getPanelSizeBounds(region);const focusRegionProps = useFocusRegionProps(region);diff --git a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.browser.test.tsxindex e210d4d0be..341b02f3d9 100644--- a/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widget-frame/WidgetRenderer.browser.test.tsx@@ -26,10 +26,10 @@ const workbenchMocks = vi.hoisted(() => ({widgetGraphs: {},widgetInstances: {},widgetRegions: {- bottom: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 240 },- center: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 240 },- left: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 240 },- right: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 240 },+ bottom: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 384 },+ center: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 384 },+ left: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 384 },+ right: { activeInstanceId: 'test-instance', instanceIds: ['test-instance'], isCollapsed: false, sizePx: 384 },},},runtime: {},@@ -300,7 +300,7 @@ describe('WidgetRenderer failure containment', () => {const panel = host?.querySelector<HTMLElement>('aside');expect(panel).not.toBeNull();// Panel width survives the crash, so the region does not collapse or overflow.- expect(panel?.getBoundingClientRect().width).toBe(240);+ expect(panel?.getBoundingClientRect().width).toBe(384);// And the drag handle is still there to resize with.expect(panel?.querySelector('[role="separator"]')).not.toBeNull();});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsxindex b62dee92e2..fc2ca11665 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewNavigation.browser.test.tsx@@ -181,6 +181,7 @@ vi.mock('@workbench/image-actions', () => ({buildImageRecallSettings: () => ({}),executeImageRecall: () => {},getCurrentGenerateValues: () => ({}),+ getImageRecallVerb: () => ({ icon: () => null, label: '' }),getGalleryCanvasImportMenuItems: () => [],getImageContextMenuImages: () => [],getImageContextMenuRecallRequestKey: () => null,diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.tsindex 41dea82e44..645db45014 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts@@ -867,7 +867,7 @@ describe('workbench layout presets', () => {let state = createInitialWorkbenchState();const projectId = state.activeProjectId;- state = workbenchReducer(state, { region: 'right', sizePx: 336, type: 'setRegionWidgetSize' });+ state = workbenchReducer(state, { region: 'right', sizePx: 384, type: 'setRegionWidgetSize' });state = workbenchReducer(state, { region: 'right', type: 'selectRegionWidget', widgetId: 'queue' });state = workbenchReducer(state, { region: 'center', type: 'selectRegionWidget', widgetId: 'preview' });state = workbenchReducer(state, {@@ -883,7 +883,7 @@ describe('workbench layout presets', () => {expect(state.account.customLayoutPresets).toHaveLength(1);expect(state.account.customLayoutPresets?.[0]).toMatchObject({ id: 'custom-layout-1', label: 'Queue review' });- expect(project.widgetRegions.right).toMatchObject({ activeInstanceId: 'queue', sizePx: 336 });+ expect(project.widgetRegions.right).toMatchObject({ activeInstanceId: 'queue', sizePx: 384 });expect(project.widgetRegions.center.activeInstanceId).toBe('preview');});@@ -1246,7 +1246,7 @@ describe('workbench layout presets', () => {it('saves the live arrangement onto a built-in preset and restores its shipped default', () => {let state = workbenchReducer(createInitialWorkbenchState(), { presetId: 'compose', type: 'applyPreset' });- state = workbenchReducer(state, { region: 'right', sizePx: 320, type: 'setRegionWidgetSize' });+ state = workbenchReducer(state, { region: 'right', sizePx: 360, type: 'setRegionWidgetSize' });state = workbenchReducer(state, { presetId: 'compose', type: 'saveLayoutPreset' });state = workbenchReducer(state, {defaultRoute: { destination: 'canvas', sourceId: 'upscale' },@@ -1254,7 +1254,7 @@ describe('workbench layout presets', () => {type: 'setLayoutPresetRoute',});- expect(state.account.layoutPresetOverrides?.compose?.widgetRegions.right.sizePx).toBe(320);+ expect(state.account.layoutPresetOverrides?.compose?.widgetRegions.right.sizePx).toBe(360);expect(state.account.layoutPresetRouteOverrides?.compose).toEqual({ destination: 'canvas', sourceId: 'upscale' });state = workbenchReducer(state, { sourceId: 'workflow', type: 'setInvocationSource' });@@ -1264,7 +1264,7 @@ describe('workbench layout presets', () => {state = workbenchReducer(state, { region: 'right', sizePx: 500, type: 'setRegionWidgetSize' });state = workbenchReducer(state, { type: 'resetActiveLayout' });- expect(getActiveProject(state).widgetRegions.right.sizePx).toBe(320);+ expect(getActiveProject(state).widgetRegions.right.sizePx).toBe(360);expect(getActiveProject(state).invocation).toMatchObject({ destination: 'gallery', sourceId: 'workflow' });state = workbenchReducer(state, { presetId: 'compose', type: 'restoreLayoutPresetDefault' });diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.tsindex 0c7f3f6e4e..50fad34da8 100644--- a/invokeai/frontend/webv2/src/workbench/workbenchState.ts+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.ts@@ -378,11 +378,24 @@ type WorkbenchReducerAction =const HISTORY_LIMIT = 40;export const GRAPH_HISTORY_BYTE_BUDGET = 64 * 1024 * 1024;const NOTIFICATION_LIMIT = 100;-const MIN_PANEL_SIZE_PX = 180;+// Side panels host real widget UIs (gallery grid, generate form); below+// ~350px their toolbars and grids collapse into unusable slivers, so that is+// the floor rather than a merely-rendered 180px. The bottom strip is a+// status row, not a widget host, and keeps its own bounds.+const MIN_PANEL_SIZE_PX = 350;const MAX_PANEL_SIZE_PX = 520;const MIN_STATUS_PANEL_SIZE_PX = 96;const MAX_STATUS_PANEL_SIZE_PX = 420;+/** The resize bounds for a widget region — shared with the resize handles. */+export const getPanelSizeBounds = (region: WidgetRegion): { max: number; min: number } => {+ if (region === 'bottom') {+ return { max: MAX_STATUS_PANEL_SIZE_PX, min: MIN_STATUS_PANEL_SIZE_PX };+ }++ return { max: MAX_PANEL_SIZE_PX, min: MIN_PANEL_SIZE_PX };+};+const now = (): string => new Date().toISOString();const createId = (prefix: string): string =>@@ -1404,11 +1417,9 @@ const recoverProjectUnderNewIdentity = ();const clampPanelSize = (region: WidgetRegion, sizePx: number): number => {- if (region === 'bottom') {- return Math.min(MAX_STATUS_PANEL_SIZE_PX, Math.max(MIN_STATUS_PANEL_SIZE_PX, sizePx));- }+ const { max, min } = getPanelSizeBounds(region);- return Math.min(MAX_PANEL_SIZE_PX, Math.max(MIN_PANEL_SIZE_PX, sizePx));+ return Math.min(max, Math.max(min, sizePx));};const createCanvasState = (): CanvasStateContractV2 => createNewCanvasStateV2();