Skip to content
Closed
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
61 changes: 52 additions & 9 deletions src/platform/settings/composables/useSettingsDialog.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { computed } from 'vue'
import { cn } from '@comfyorg/tailwind-utils'
import type { DialogContentSize } from '@/components/ui/dialog/dialog.variants'
import { dialogContentVariants } from '@/components/ui/dialog/dialog.variants'
import { useBillingContext } from '@/composables/billing/useBillingContext'
import { useDialogStore } from '@/stores/dialogStore'
/**
* Settings dialog migration regression net: `useSettingsDialog().show()` must
* open the Reka-renderer path with sizing that matches the previous
* `BaseModalLayout size="sm"` (960px × 80vh). Catches accidental reverts of
* the Phase 3 renderer flip.
* Settings dialog regression net: `useSettingsDialog().show()` must open the
* Reka-renderer path at the 1280px design width, capped to the workspace a
* docked Agent panel leaves. Catches accidental reverts of the Phase 3
* renderer flip and of the workspace-inset cap.
*/
import { beforeEach, describe, expect, it, vi } from 'vitest'

Expand Down Expand Up @@ -46,19 +49,59 @@ describe('useSettingsDialog', () => {
isCloudRef.value = false
})

it("show() opens the Reka renderer with size 'full' and 1280px content sizing", () => {
const RESERVES_INSET = /var\(--workspace-inset-right,_?0px\)/

const resolveAgainstVariant = (args: {
dialogComponentProps: { size: DialogContentSize; contentClass: string }
}): string =>
cn(
dialogContentVariants({
size: args.dialogComponentProps.size,
maximized: false
}),
args.dialogComponentProps.contentClass
)

it("show() opens the Reka renderer with size 'full'", () => {
useSettingsDialog().show()
const [args] = showDialog.mock.calls[0]
expect(args.key).toBe('global-settings')
expect(args.dialogComponentProps.renderer).toBe('reka')
expect(args.dialogComponentProps.size).toBe('full')
expect(args.dialogComponentProps.contentClass).toContain('max-w-[1280px]')
expect(args.dialogComponentProps.contentClass).not.toContain(
'max-w-[960px]'
)
expect(args.dialogComponentProps.contentClass).toContain('h-[80vh]')
})

it('show() caps both breakpoints at 1280px within the docked Agent panel inset', () => {
useSettingsDialog().show()
const [args] = showDialog.mock.calls[0]

const survivingCaps = resolveAgainstVariant(args)
.split(' ')
.filter((utility) => /(^|:)max-w-\[/.test(utility))

expect(survivingCaps.some((cap) => cap.startsWith('sm:'))).toBe(true)
expect(survivingCaps.some((cap) => !cap.startsWith('sm:'))).toBe(true)
expect(
survivingCaps.filter(
(cap) => !cap.includes('1280px') || !RESERVES_INSET.test(cap)
)
).toEqual([])
})

it('show() keeps the workspace-aware centering that the cap is sized for', () => {
useSettingsDialog().show()
const [args] = showDialog.mock.calls[0]

const horizontalPlacement = resolveAgainstVariant(args)
.split(' ')
.filter((utility) => /(^|:)left-/.test(utility))

expect(horizontalPlacement).not.toHaveLength(0)
expect(
horizontalPlacement.filter((utility) => !RESERVES_INSET.test(utility))
).toEqual([])
})

it('show() uses non-modal Reka so nested PrimeVue dialogs keep focus and pointer events', () => {
useSettingsDialog().show()
const [args] = showDialog.mock.calls[0]
Expand Down
6 changes: 4 additions & 2 deletions src/platform/settings/composables/useSettingsDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import type { SettingPanelType } from '@/platform/settings/types'

const DIALOG_KEY = 'global-settings'

// The redesigned Settings dialog is 1280px wide (DES 3253-16079).
// The redesigned Settings dialog is 1280px wide (DES 3253-16079), capped to the
// workspace a docked Agent panel leaves. The `sm:` copy is required: without it
// the `size: 'full'` variant's workspace-only `sm:max-w` drops the 1280px bound.
const SETTINGS_CONTENT_CLASS =
'w-[90vw] max-w-[1280px] sm:max-w-[1280px] h-[80vh] max-h-none rounded-2xl overflow-hidden'
'w-[90vw] max-w-[min(1280px,calc(100vw-var(--workspace-inset-right,0px)-1rem))] sm:max-w-[min(1280px,calc(100vw-var(--workspace-inset-right,0px)-1rem))] h-[80vh] max-h-none rounded-2xl overflow-hidden'
Comment on lines 13 to +14

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll fix this more fundamentally when I get to this section of the design system.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed — this is a per-call-site patch, not a structural fix. Left the code as-is.

I filed FE-3189 for exactly that structural work, with the two root causes already pinned down so you don't have to re-derive them:

  1. The variant caps have no lower bound. dialog.variants.ts:8-12 sizes every dialog as max-w-[min(<size>,calc(100vw-var(--workspace-inset-right,0px)-1rem))], and that calc tracks the workspace all the way to zero. Load3D, Asset Browser, Share and now Settings all inherit it.

  2. The dialog interior is keyed to the window, not the dialog. BaseModalLayout.vue:185 resolves BREAKPOINTS = { md: 880 } through window.matchMedia, and the left nav is a fixed 14rem track. Before the inset cap, box width and window width agreed; now the box tracks 100vw − inset and the two can diverge by the full panel width, so the nav stays open inside a much narrower dialog.

Worst case I measured: viewport 1200, panel maximized to 960, sidebar closed — isOverlay doesn't trigger (reservedWorkspaceWidth floors at 56 when the sidebar is closed), so the workspace is 240px and the content column collapses behind the 224px nav.

Two things worth folding into that pass while you're in there:

  • Templates and Manager carry the identical shape — w-[90vw] max-w-[1400px] sm:max-w-[1400px] and max-w-[1724px] respectively. useWorkflowTemplateSelectorDialog.ts even comments "Size it like the other large dialogs (Settings/Manager)", so it propagated by imitation. A variant-level fix covers all three at once.
  • PM-1865 has the open product question — Christian asked whether modals should shrink for the Agent panel at all. That answer changes the shape of the structural fix, so probably worth settling first.

For the record on this PR: I did try a lower bound here (min(1280px,max(20rem,calc(…)))) and backed it out — it bought ~33px of content column but reintroduced a 10px overflow on both sides, which is the defect this PR exists to remove. Seemed better to keep the call site consistent with the shared pattern and let the fix land at the variant level.


export function useSettingsDialog() {
const dialogService = useDialogService()
Expand Down
Loading