Compare commits

..

1 Commits

Author SHA1 Message Date
CodeRabbit Fixer
140e0a128d fix: docs: document UUID injection behavior in createTemporary() and createNewTemporary() (#9448)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 14:55:08 +01:00
4 changed files with 46 additions and 24 deletions

View File

@@ -4,7 +4,7 @@
class="scrollbar-thin scrollbar-track-transparent scrollbar-thumb-(--dialog-surface) h-full overflow-y-auto [overflow-anchor:none] [scrollbar-gutter:stable]"
>
<div :style="topSpacerStyle" />
<div :class="gridClass" :style="mergedGridStyle">
<div :style="mergedGridStyle">
<div
v-for="(item, i) in renderedItems"
:key="item.key"
@@ -32,7 +32,6 @@ type GridState = {
const {
items,
gridStyle,
gridClass,
bufferRows = 1,
scrollThrottle = 64,
resizeDebounce = 64,
@@ -41,8 +40,7 @@ const {
maxColumns = Infinity
} = defineProps<{
items: (T & { key: string })[]
gridStyle?: CSSProperties
gridClass?: string
gridStyle: CSSProperties
bufferRows?: number
scrollThrottle?: number
resizeDebounce?: number
@@ -73,7 +71,7 @@ const cols = computed(() => {
})
const mergedGridStyle = computed<CSSProperties>(() => {
if (maxColumns === Infinity) return gridStyle ?? {}
if (maxColumns === Infinity) return gridStyle
return {
...gridStyle,
gridTemplateColumns: `repeat(${maxColumns}, minmax(0, 1fr))`

View File

@@ -178,7 +178,7 @@
"uploadAlreadyInProgress": "Upload already in progress",
"capture": "capture",
"nodes": "Nodes",
"nodesCount": "{count} node | {count} nodes",
"nodesCount": "{count} nodes | {count} node | {count} nodes",
"addNode": "Add a node...",
"filterBy": "Filter by:",
"filterByType": "Filter by {type}...",
@@ -222,7 +222,7 @@
"failed": "Failed",
"cancelled": "Cancelled",
"job": "Job",
"asset": "{count} asset | {count} assets",
"asset": "{count} assets | {count} asset | {count} assets",
"untitled": "Untitled",
"emDash": "—",
"enabling": "Enabling {id}",
@@ -3347,7 +3347,7 @@
}
},
"errorOverlay": {
"errorCount": "{count} ERROR | {count} ERRORS",
"errorCount": "{count} ERRORS | {count} ERROR | {count} ERRORS",
"seeErrors": "See Errors"
},
"help": {
@@ -3357,7 +3357,7 @@
"progressToast": {
"importingModels": "Importing Models",
"downloadingModel": "Downloading model...",
"downloadsFailed": "{count} download failed | {count} downloads failed",
"downloadsFailed": "{count} downloads failed | {count} download failed | {count} downloads failed",
"allDownloadsCompleted": "All downloads completed",
"noImportsInQueue": "No {filter} in queue",
"failed": "Failed",
@@ -3374,7 +3374,7 @@
"exportingAssets": "Exporting Assets",
"preparingExport": "Preparing export...",
"exportError": "Export failed",
"exportFailed": "{count} export failed | {count} exports failed",
"exportFailed": "{count} export failed | {count} export failed | {count} exports failed",
"allExportsCompleted": "All exports completed",
"noExportsInQueue": "No {filter} exports in queue",
"exportStarted": "Preparing ZIP download...",

View File

@@ -255,6 +255,13 @@ export const useWorkflowStore = defineStore('workflow', () => {
return workflow
}
/**
* Ensures the workflow data has a stable `id` field for sharing.
* If the provided (or default) workflow data does not contain an `id`,
* a new UUID is generated and injected into the returned copy.
*
* @returns A deep copy of the workflow data with a guaranteed `id` field.
*/
const ensureWorkflowId = (
workflowData?: ComfyWorkflowJSON
): ComfyWorkflowJSON => {
@@ -270,7 +277,11 @@ export const useWorkflowStore = defineStore('workflow', () => {
}
/**
* Helper to create a new temporary workflow
* Helper to create a new temporary workflow.
*
* Calls {@link ensureWorkflowId} to guarantee the workflow data contains
* a UUID `id` field. If the provided data has no `id`, one is generated
* and injected into the serialized content.
*/
const createNewWorkflow = (
path: string,
@@ -291,7 +302,13 @@ export const useWorkflowStore = defineStore('workflow', () => {
}
/**
* Create a temporary workflow, attempting to reuse an existing workflow if conditions match
* Create a temporary workflow, attempting to reuse an existing workflow
* if conditions match.
*
* Note: A UUID `id` field is injected into the workflow data via
* {@link ensureWorkflowId} if one is not already present. The serialized
* workflow content will always contain an `id` field, even if none was
* provided in the input.
*/
const createTemporary = (path?: string, workflowData?: ComfyWorkflowJSON) => {
const fullPath = getUnconflictedPath(
@@ -323,7 +340,13 @@ export const useWorkflowStore = defineStore('workflow', () => {
}
/**
* Create a new temporary workflow without attempting to reuse existing workflows
* Create a new temporary workflow without attempting to reuse existing
* workflows.
*
* Note: A UUID `id` field is injected into the workflow data via
* {@link ensureWorkflowId} if one is not already present. The serialized
* workflow content will always contain an `id` field, even if none was
* provided in the input.
*/
const createNewTemporary = (
path?: string,

View File

@@ -1,9 +1,7 @@
<script setup lang="ts">
import type { MaybeRefOrGetter } from 'vue'
import type { CSSProperties, MaybeRefOrGetter } from 'vue'
import { computed } from 'vue'
import { cn } from '@/utils/tailwindUtil'
import VirtualGrid from '@/components/common/VirtualGrid.vue'
import type {
@@ -60,7 +58,7 @@ type LayoutConfig = {
maxColumns: number
itemHeight: number
itemWidth: number
gapClass: string
gap: string
}
const LAYOUT_CONFIGS: Record<LayoutMode, LayoutConfig> = {
@@ -68,19 +66,19 @@ const LAYOUT_CONFIGS: Record<LayoutMode, LayoutConfig> = {
maxColumns: 4,
itemHeight: 120,
itemWidth: 89,
gapClass: 'gap-x-2 gap-y-4'
gap: 'var(--spacing-4) var(--spacing-2)'
},
list: {
maxColumns: 1,
itemHeight: 64,
itemWidth: 380,
gapClass: 'gap-2'
gap: 'var(--spacing-2)'
},
'list-small': {
maxColumns: 1,
itemHeight: 40,
itemWidth: 380,
gapClass: 'gap-1'
gap: 'var(--spacing-1)'
}
}
@@ -88,9 +86,12 @@ const layoutConfig = computed<LayoutConfig>(
() => LAYOUT_CONFIGS[layoutMode.value ?? 'grid']
)
const gridClass = computed(() =>
cn('grid w-full p-4', layoutConfig.value.gapClass)
)
const gridStyle = computed<CSSProperties>(() => ({
display: 'grid',
gap: layoutConfig.value.gap,
padding: '1rem',
width: '100%'
}))
type VirtualDropdownItem = FormDropdownItem & { key: string }
const virtualItems = computed<VirtualDropdownItem[]>(() =>
@@ -138,7 +139,7 @@ const virtualItems = computed<VirtualDropdownItem[]>(() =>
v-else
:key="layoutMode"
:items="virtualItems"
:grid-class="gridClass"
:grid-style
:max-columns="layoutConfig.maxColumns"
:default-item-height="layoutConfig.itemHeight"
:default-item-width="layoutConfig.itemWidth"