Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions browser_tests/tests/load3d/load3dAgentUpdate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })

Expand Down Expand Up @@ -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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low — Asserting a fixed 8px left gutter only holds while the inset branch of min(80vw, 100vw - inset - 1rem) binds, i.e. while the panel is at least 0.2 * viewportWidth - 16 wide. That is true at 1280/1920 with the 420px panel default, but lowering PANEL_MIN_WIDTH or adding a wider viewport flips to the 80vw branch, where the viewer still centres correctly with a larger gutter and this step fails on correct layout. Since the step is named "centre the viewer", assert the centring relation (dialogBox.x close to (panelBox.x - dialogBox.width) / 2), which holds on both branches. Raised by 2 of 8 reviewers (gemini-3.1-pro edge-case, claude-opus-5-thinking-max edge-case).

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 })

Expand Down
7 changes: 2 additions & 5 deletions src/components/load3d/controls/ViewerControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
}
Expand Down
11 changes: 9 additions & 2 deletions src/components/load3d/load3dViewerDialog.ts
Original file line number Diff line number Diff line change
@@ -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 = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low — This shared object is neither frozen nor as const, and three of the five call sites (AssetsSidebarTab.vue, JobHistorySidebarTab.vue, hdrViewerService.ts) hand the module-level instance to showDialog by reference instead of spreading it. createDialog uses options.dialogComponentProps?.pt as the in-place target of es-toolkit's merge, so the day this constant gains a pt (or any other nested object) that mutation writes per-dialog state into the singleton and leaks it into every later viewer dialog. Freeze the constant or spread it at all five call sites. Raised by 3 of 8 reviewers (claude-opus-5-thinking-max adversarial, kimi-k3-max adversarial, kimi-k3-max edge-case).

renderer: 'reka',
size: 'full',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Nit — size: 'full' is now inert for these dialogs: the only class that variant contributes is sm:max-w-*, and the newly added sm:max-w-[min(...)] in contentClass is merged after it, so tailwind-merge always drops it. Changing size here would have no visible effect, which could mislead a maintainer tuning the viewer width. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).

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
8 changes: 2 additions & 6 deletions src/components/sidebar/tabs/AssetsSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 2 additions & 6 deletions src/components/sidebar/tabs/JobHistorySidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
}
Expand Down
7 changes: 2 additions & 5 deletions src/extensions/core/load3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
Expand Down
8 changes: 2 additions & 6 deletions src/services/hdrViewerService.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Nit — The HDR viewer, assets sidebar, job history, and agent reply dialogs now all derive their geometry from a Load3D-owned constant, so any future Load3D-specific sizing tweak silently resizes four unrelated surfaces that have no test coverage outside the Load3D spec. Consider hoisting the shared geometry into a neutral viewer-dialog module so the blast radius of a change is explicit. Raised by 2 of 8 reviewers (gemini-3.1-pro edge-case, claude-opus-5-thinking-max adversarial).

})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
})
Expand Down
Loading