diff --git a/invokeai/frontend/web/src/features/ui/hooks/usePanel.ts b/invokeai/frontend/web/src/features/ui/hooks/usePanel.ts index 871bd931352..f667626f03e 100644 --- a/invokeai/frontend/web/src/features/ui/hooks/usePanel.ts +++ b/invokeai/frontend/web/src/features/ui/hooks/usePanel.ts @@ -101,7 +101,7 @@ export const usePanel = (arg: UsePanelOptions): UsePanelReturn => { arg.panelGroupDirection ); - if (minSizePct > 100) { + if (!minSizePct || minSizePct > 100 || !defaultSizePct || defaultSizePct > 100) { // This can happen when the panel is hidden return; } @@ -244,6 +244,11 @@ const getSizeAsPercentage = ( let availableSpace = panelGroupDirection === 'horizontal' ? panelGroupElement.offsetWidth : panelGroupElement.offsetHeight; + if (!availableSpace) { + // No available space, size is 0 + return 0; + } + // ...minus the width/height of the resize handles getResizeHandleElementsForGroup(id).forEach((el) => { availableSpace -= panelGroupDirection === 'horizontal' ? el.offsetWidth : el.offsetHeight;