From 4c596b62a1d9c06203899f55313733def0648e92 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 2 Oct 2026 19:05:20 +0000 Subject: [PATCH 1/2] fix(load3d): apply workspace inset to every viewer (#19729) ## Summary - route every Load3D and HDR viewer through one inset-aware dialog configuration - remove raw-viewport centering overrides that let the docked Agent panel cover viewer content - keep the responsive 80vw cap paired with the full-size dialog variant This follows up on findings from the merged [core/1.55 backport](https://github.com/Comfy-Org/ComfyUI_frontend/pull/19702#discussion_r4152132317) and [cloud/1.55 backport](https://github.com/Comfy-Org/ComfyUI_frontend/pull/19703#discussion_r4152121127). ## Changes - apply the shared configuration to HDR, Agent reply, Assets, Job History, node, and viewer-control entry points - centralize `renderer`, `size`, `contentClass`, and `maximizable` so responsive geometry cannot drift across callers - remove brittle class-token assertions; browser coverage measures the visible viewer geometry ## Review Focus - confirm the shared `sm:max-w` override remains paired with `size: full` - confirm viewers with custom `onClose` behavior preserve it when spreading the shared configuration ## Validation - `oxfmt --check` passed for all nine changed files - `git diff --check` passed - the focused Vitest runner stalled before producing output in this workspace; CI is rerunning the affected suites (cherry picked from commit 3c4030d80e619e0276dcd65667dc793acccf1525) --- src/components/load3d/controls/ViewerControls.vue | 7 ++----- src/components/load3d/load3dViewerDialog.ts | 11 +++++++++-- src/components/sidebar/tabs/AssetsSidebarTab.vue | 8 ++------ src/components/sidebar/tabs/JobHistorySidebarTab.vue | 8 ++------ src/extensions/core/load3d.ts | 7 ++----- src/services/hdrViewerService.ts | 8 ++------ .../components/agent/message/ReplyAssetGroup.vue | 6 ++---- 7 files changed, 21 insertions(+), 34 deletions(-) diff --git a/src/components/load3d/controls/ViewerControls.vue b/src/components/load3d/controls/ViewerControls.vue index 9e3d21ef9cf..f20cfc6a531 100644 --- a/src/components/load3d/controls/ViewerControls.vue +++ b/src/components/load3d/controls/ViewerControls.vue @@ -23,7 +23,7 @@ import { useI18n } from 'vue-i18n' import Load3DViewerContent from '@/components/load3d/Load3dViewerContent.vue' import Button from '@/components/ui/button/Button.vue' -import { LOAD3D_VIEWER_CONTENT_CLASS } from '@/components/load3d/load3dViewerDialog' +import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog' import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode' import { useLoad3dService } from '@/services/load3dService' import { useDialogStore } from '@/stores/dialogStore' @@ -42,10 +42,7 @@ const openIn3DViewer = () => { component: Load3DViewerContent, props: props, dialogComponentProps: { - renderer: 'reka', - size: 'full', - contentClass: LOAD3D_VIEWER_CONTENT_CLASS, - maximizable: true, + ...LOAD3D_VIEWER_DIALOG_PROPS, onClose: async () => { await useLoad3dService().handleViewerClose(props.node) } diff --git a/src/components/load3d/load3dViewerDialog.ts b/src/components/load3d/load3dViewerDialog.ts index 2d655dd5729..a586557f16d 100644 --- a/src/components/load3d/load3dViewerDialog.ts +++ b/src/components/load3d/load3dViewerDialog.ts @@ -1,2 +1,9 @@ -export const LOAD3D_VIEWER_CONTENT_CLASS = - 'w-[80vw] max-w-[min(80vw,calc(100vw-var(--workspace-inset-right,0px)-1rem))] h-[80vh] max-h-[80vh]' +import type { DialogComponentProps } from '@/stores/dialogStore' + +export const LOAD3D_VIEWER_DIALOG_PROPS = { + renderer: 'reka', + size: 'full', + contentClass: + 'w-[80vw] max-w-[min(80vw,calc(100vw-var(--workspace-inset-right,0px)-1rem))] sm:max-w-[min(80vw,calc(100vw-var(--workspace-inset-right,0px)-1rem))] h-[80vh] max-h-[80vh]', + maximizable: true +} satisfies DialogComponentProps diff --git a/src/components/sidebar/tabs/AssetsSidebarTab.vue b/src/components/sidebar/tabs/AssetsSidebarTab.vue index 476c3be7b8e..c89f30a5720 100644 --- a/src/components/sidebar/tabs/AssetsSidebarTab.vue +++ b/src/components/sidebar/tabs/AssetsSidebarTab.vue @@ -201,6 +201,7 @@ import { import { useI18n } from 'vue-i18n' import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue' +import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog' import AssetsSidebarGridView from '@/components/sidebar/tabs/AssetsSidebarGridView.vue' import AssetsSidebarListView from '@/components/sidebar/tabs/AssetsSidebarListView.vue' import SidebarTabTemplate from '@/components/sidebar/tabs/SidebarTabTemplate.vue' @@ -574,12 +575,7 @@ const handleZoomClick = (asset: AssetItem) => { props: { modelUrl: getAssetFileUrl(asset) }, - dialogComponentProps: { - renderer: 'reka', - size: 'full', - contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]', - maximizable: true - } + dialogComponentProps: LOAD3D_VIEWER_DIALOG_PROPS }) return } diff --git a/src/components/sidebar/tabs/JobHistorySidebarTab.vue b/src/components/sidebar/tabs/JobHistorySidebarTab.vue index 9a7b52c47c4..f933ac3ee12 100644 --- a/src/components/sidebar/tabs/JobHistorySidebarTab.vue +++ b/src/components/sidebar/tabs/JobHistorySidebarTab.vue @@ -77,6 +77,7 @@ import { computed, defineAsyncComponent, ref } from 'vue' import { useI18n } from 'vue-i18n' +import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog' import JobFilterActions from '@/components/queue/job/JobFilterActions.vue' import JobFilterTabs from '@/components/queue/job/JobFilterTabs.vue' import JobAssetsList from '@/components/queue/job/JobAssetsList.vue' @@ -189,12 +190,7 @@ const onViewItem = wrapWithErrorHandlingAsync(async (item: JobListItem) => { props: { modelUrl: previewOutput.url || '' }, - dialogComponentProps: { - renderer: 'reka', - size: 'full', - contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]', - maximizable: true - } + dialogComponentProps: LOAD3D_VIEWER_DIALOG_PROPS }) return } diff --git a/src/extensions/core/load3d.ts b/src/extensions/core/load3d.ts index fa382d7d00e..5f17b40f22e 100644 --- a/src/extensions/core/load3d.ts +++ b/src/extensions/core/load3d.ts @@ -2,7 +2,7 @@ import { nextTick } from 'vue' import Load3D from '@/components/load3d/Load3D.vue' import Load3DViewerContent from '@/components/load3d/Load3dViewerContent.vue' -import { LOAD3D_VIEWER_CONTENT_CLASS } from '@/components/load3d/load3dViewerDialog' +import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog' import { getLoad3dOutputCache, getLoad3dSceneRevision, @@ -286,10 +286,7 @@ useExtensionService().registerExtension({ component: Load3DViewerContent, props: props, dialogComponentProps: { - renderer: 'reka', - size: 'full', - contentClass: LOAD3D_VIEWER_CONTENT_CLASS, - maximizable: true, + ...LOAD3D_VIEWER_DIALOG_PROPS, onClose: async () => { await useLoad3dService().handleViewerClose(props.node) } diff --git a/src/services/hdrViewerService.ts b/src/services/hdrViewerService.ts index 011e7c89e3b..363022817e3 100644 --- a/src/services/hdrViewerService.ts +++ b/src/services/hdrViewerService.ts @@ -1,5 +1,6 @@ import { defineAsyncComponent } from 'vue' +import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog' import { t } from '@/i18n' import { useDialogStore } from '@/stores/dialogStore' import { @@ -18,11 +19,6 @@ export function openHdrViewer(url: string) { title: getImageFilenameFromUrl(fullResUrl) ?? t('hdrViewer.title'), component: HdrViewerContent, props: { imageUrl: fullResUrl }, - dialogComponentProps: { - renderer: 'reka', - size: 'full', - contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]', - maximizable: true - } + dialogComponentProps: LOAD3D_VIEWER_DIALOG_PROPS }) } diff --git a/src/workbench/extensions/agent/components/agent/message/ReplyAssetGroup.vue b/src/workbench/extensions/agent/components/agent/message/ReplyAssetGroup.vue index 1da9c804781..6064a16fa45 100644 --- a/src/workbench/extensions/agent/components/agent/message/ReplyAssetGroup.vue +++ b/src/workbench/extensions/agent/components/agent/message/ReplyAssetGroup.vue @@ -2,6 +2,7 @@ import { computed, defineAsyncComponent, ref, watch } from 'vue' import { useI18n } from 'vue-i18n' +import { LOAD3D_VIEWER_DIALOG_PROPS } from '@/components/load3d/load3dViewerDialog' import Button from '@/components/ui/button/Button.vue' import { findOutputAsset, @@ -125,10 +126,7 @@ function inspect(asset: ReplyAsset): void { component: Load3dViewerContent, props: { modelUrl: asset.url }, dialogComponentProps: { - renderer: 'reka', - size: 'full', - contentClass: 'left-1/2 w-[80vw] sm:max-w-[80vw] h-[80vh] max-h-[80vh]', - maximizable: true, + ...LOAD3D_VIEWER_DIALOG_PROPS, onClose: () => refreshModelThumbnail(asset) } }) From 94c8094458e759472a508db5ec7623e5c34e2d4d Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 4 Oct 2026 16:02:58 -0700 Subject: [PATCH 2/2] test(load3d): pin the viewer's docked-panel geometry above the sm breakpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Load3D/HDR viewer is the one dialog that stays inset-aware after #20002: its own `max-w-[min(80vw,calc(100vw-var(--workspace-inset-right,0px)-1rem))]` is what holds it on the centring branch of the new translate-x clamp instead of the viewport gutter floor, so it still clears the docked Agent panel while every other dialog keeps its size and covers the panel. That cap is declared twice — unprefixed and `sm:`-prefixed — because tailwind-merge treats prefixed and unprefixed `max-w-*` as separate groups, and above `sm:` only the prefixed one is live. The existing guard in this test runs at 500px and 400px, both under `sm:`, so it cannot see the prefixed cap at all: dropping it leaves this spec green while the viewer covers the panel by 180px at 1280px. Add a step at 1280px and 1920px asserting the real docked panel is flush with the right edge, the viewer sits at the 8px gutter, and its right edge stops 8px short of the panel. Measured against the real 420px docked panel at main 94ddfcc78d: | viewport | viewer x | viewer right | panel left | | --- | --- | --- | --- | | 1280 | 8 | 852 | 860 | | 1440 | 8 | 1012 | 1020 | | 1920 | 8 | 1492 | 1500 | (cherry picked from commit 3bca0a35c0126876a3cf9a009b52f2d55c939d3f) --- .../tests/load3d/load3dAgentUpdate.spec.ts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/browser_tests/tests/load3d/load3dAgentUpdate.spec.ts b/browser_tests/tests/load3d/load3dAgentUpdate.spec.ts index 1e116466039..ffcb43523c7 100644 --- a/browser_tests/tests/load3d/load3dAgentUpdate.spec.ts +++ b/browser_tests/tests/load3d/load3dAgentUpdate.spec.ts @@ -4,6 +4,10 @@ import { AgentPanel } from '@e2e/fixtures/components/AgentPanel' import { load3dAgentTest as test } from '@e2e/fixtures/load3dAgentFixture' import { Load3DViewerHelper } from '@e2e/tests/load3d/Load3DViewerHelper' +// The 0.5rem gutter the dialog clamp leaves at the viewport edge, and half of +// the 1rem the viewer's own width cap reserves inside the visible workspace. +const VIEWPORT_GUTTER = 8 + test.describe('Load3D agent updates', { tag: '@cloud' }, () => { test.describe.configure({ timeout: 60_000 }) @@ -69,6 +73,36 @@ test.describe('Load3D agent updates', { tag: '@cloud' }, () => { await viewer.waitForOpen() }) + await test.step('centre the viewer beside the panel above the sm breakpoint', async () => { + // The viewer keeps its own inset-aware width cap while every other dialog + // now resolves against the raw viewport, and that cap is what holds it on + // the centring branch of the dialog clamp instead of the gutter floor. + // The cap is declared twice — unprefixed and `sm:`-prefixed — because + // tailwind-merge treats those as separate groups, so only the prefixed one + // is live here. The narrow-viewport steps below run under `sm:` and cannot + // see it: drop it and they still pass while the viewer covers the panel. + for (const width of [1280, 1920]) { + await page.setViewportSize({ width, height: 800 }) + + await expect(async () => { + const dialogBox = await viewer.dialog.boundingBox() + const panelBox = await panel.boundingBox() + expect(dialogBox).not.toBeNull() + expect(panelBox).not.toBeNull() + if (!dialogBox || !panelBox) return + + // The panel is docked against the right edge, so its left edge is the + // boundary of the visible workspace. + expect(panelBox.x + panelBox.width).toBeCloseTo(width, 1) + expect(dialogBox.x).toBeCloseTo(VIEWPORT_GUTTER, 1) + expect(dialogBox.x + dialogBox.width).toBeCloseTo( + panelBox.x - VIEWPORT_GUTTER, + 1 + ) + }).toPass({ timeout: 5000 }) + } + }) + await test.step('keep the viewer outside the docked Agent panel', async () => { await page.setViewportSize({ width: 500, height: 800 })