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
2 changes: 1 addition & 1 deletion src/extensions/core/widgetInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class PrimitiveNode extends LGraphNode {
for (let i = 0; i < this.widgets_values.length; i++) {
const w = this.widgets[i]
if (w) {
w.value = this.widgets_values[i] as any
w.value = this.widgets_values[i]
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/platform/cloud/onboarding/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function captureApiError(
errorType: 'http_error' | 'network_error',
httpStatus?: number,
operation?: string,
extraContext?: Record<string, any>
extraContext?: Record<string, unknown>
) {
const tags: Record<string, any> = {
const tags: Record<string, string | number> = {
api_endpoint: endpoint,
error_type: errorType
}
Expand All @@ -33,7 +33,7 @@ function captureApiError(
tags.operation = operation
}

const sentryOptions: any = {
const sentryOptions: Sentry.ExclusiveEventHintOrCaptureContext = {
tags,
extra: extraContext ? { ...extraContext } : undefined
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
startTopupTracking as startTopupUtil
} from '@/platform/telemetry/topupTracker'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import type { AuditLog } from '@/services/customerEventsService'
import { useWorkflowTemplatesStore } from '@/platform/workflow/templates/repositories/workflowTemplatesStore'
import { app } from '@/scripts/app'
import { useNodeDefStore } from '@/stores/nodeDefStore'
Expand Down Expand Up @@ -261,7 +262,7 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
startTopupUtil()
}

checkForCompletedTopup(events: any[] | undefined | null): boolean {
checkForCompletedTopup(events: AuditLog[] | undefined | null): boolean {
return checkTopupUtil(events)
}

Expand Down
11 changes: 6 additions & 5 deletions src/platform/workflow/management/stores/workflowStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,12 @@ export const useWorkflowStore = defineStore('workflow', () => {
) as ComfyWorkflowJSON
state.id = id

const workflow: ComfyWorkflow = new (existingWorkflow.constructor as any)({
path,
modified: Date.now(),
size: -1
})
const workflow: ComfyWorkflow =
new (existingWorkflow.constructor as typeof ComfyWorkflow)({
path,
modified: Date.now(),
size: -1
})
workflow.originalContent = workflow.content = JSON.stringify(state)
workflowLookup.value[workflow.path] = workflow
return workflow
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type Clipspace = {
widgets?: Pick<IBaseWidget, 'type' | 'name' | 'value'>[] | null
imgs?: HTMLImageElement[] | null
original_imgs?: HTMLImageElement[] | null
images?: any[] | null
images?: ResultItem[] | null
selectedIndex: number
img_paste_mode: string
paintedIndex: number
Expand Down
33 changes: 18 additions & 15 deletions src/services/colorPaletteService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,25 @@ export const useColorPaletteService = () => {
}
app.canvas._pattern = undefined

for (const [key, value] of Object.entries(palette)) {
if (Object.prototype.hasOwnProperty.call(LiteGraph, key)) {
if (key === 'NODE_DEFAULT_SHAPE' && typeof value === 'string') {
console.warn(
`litegraph_base.NODE_DEFAULT_SHAPE only accepts [${[
LiteGraph.BOX_SHAPE,
LiteGraph.ROUND_SHAPE,
LiteGraph.CARD_SHAPE
].join(', ')}] but got ${value}`
)
LiteGraph.NODE_DEFAULT_SHAPE = LiteGraph.ROUND_SHAPE
} else {
;(LiteGraph as any)[key] = value
}
}
if (typeof palette.NODE_DEFAULT_SHAPE === 'string')
console.warn(
`litegraph_base.NODE_DEFAULT_SHAPE only accepts [${[
LiteGraph.BOX_SHAPE,
LiteGraph.ROUND_SHAPE,
LiteGraph.CARD_SHAPE
].join(', ')}] but got ${palette.NODE_DEFAULT_SHAPE}`
)

const default_shape =
typeof palette.NODE_DEFAULT_SHAPE === 'string'
? LiteGraph.ROUND_SHAPE
: palette.NODE_DEFAULT_SHAPE
const sanitizedPalette: Partial<typeof LiteGraph> = {
...palette,
NODE_DEFAULT_SHAPE: default_shape
}

Object.assign(LiteGraph, sanitizedPalette)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/services/customerEventsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const useCustomerEventsService = () => {
.join(' ')
}

function formatJsonValue(value: any) {
function formatJsonValue(value: unknown) {
if (typeof value === 'number') {
// Format numbers with commas and decimals if needed
return value.toLocaleString()
Expand Down
18 changes: 15 additions & 3 deletions src/services/load3dService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import type Load3d from '@/extensions/core/load3d/Load3d'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import type { NodeId } from '@/platform/workflow/validation/schemas/workflowSchema'

// Type definitions for Load3D node
interface SceneConfig {
backgroundImage?: string
}
Comment on lines 10 to 13
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if SceneConfig exists in the extensions directory
fd -t f "interfaces.ts" | head -20

Repository: Comfy-Org/ComfyUI_frontend

Length of output: 146


🏁 Script executed:

#!/bin/bash
# Search for all SceneConfig interface definitions in the codebase
rg "interface SceneConfig" -A 5

Repository: Comfy-Org/ComfyUI_frontend

Length of output: 775


🏁 Script executed:

#!/bin/bash
# Check the current state of load3dService.ts around lines 10-14
sed -n '1,30p' src/services/load3dService.ts

Repository: Comfy-Org/ComfyUI_frontend

Length of output: 970


Consider importing the existing SceneConfig interface instead of defining a local duplicate.

There's already a SceneConfig interface defined in src/extensions/core/load3d/interfaces.ts with more complete properties (showGrid, backgroundColor, backgroundImage, backgroundRenderMode). The local definition here is a subset that may drift out of sync.

♻️ Proposed refactor to use the existing interface
-// Type definitions for Load3D node
-interface SceneConfig {
-  backgroundImage?: string
-  [key: string]: unknown
-}
+import type { SceneConfig } from '@/extensions/core/load3d/interfaces'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Type definitions for Load3D node
interface SceneConfig {
backgroundImage?: string
[key: string]: unknown
}
import type { SceneConfig } from '@/extensions/core/load3d/interfaces'
🤖 Prompt for AI Agents
In `@src/services/load3dService.ts` around lines 10 - 14, You’ve duplicated the
SceneConfig interface locally; replace the local definition in load3dService.ts
with an import of the canonical SceneConfig interface from the project’s load3d
interfaces module so you use the full, single source of truth (including
showGrid, backgroundColor, backgroundImage, backgroundRenderMode); update the
import statements to import SceneConfig and remove the local interface
declaration to prevent drift.


interface Load3DNode extends LGraphNode {
syncLoad3dConfig?: () => void
}

const viewerInstances = new Map<NodeId, any>()
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remaining any type should be addressed.

This PR aims to remove explicit any usages, but viewerInstances still uses Map<NodeId, any>. Consider typing the return value of useLoad3dViewer or using unknown as a safer alternative.

♻️ Proposed refactor
-const viewerInstances = new Map<NodeId, any>()
+const viewerInstances = new Map<NodeId, ReturnType<typeof useLoad3dViewer>>()

As per coding guidelines: "NEVER use any type - use proper TypeScript types".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const viewerInstances = new Map<NodeId, any>()
const viewerInstances = new Map<NodeId, ReturnType<typeof useLoad3dViewer>>()
🤖 Prompt for AI Agents
In `@src/services/load3dService.ts` at line 19, viewerInstances is typed as
Map<NodeId, any>, which breaks the "no any" rule; update the map to use a
concrete viewer instance type (or Map<NodeId, unknown> if the concrete type is
not yet defined) and propagate that type from the factory/hook that creates it
(useLoad3dViewer) by exporting/annotating its return type so the map and
consumers are strongly typed; locate viewerInstances and the useLoad3dViewer
function and replace the any with the appropriate interface/class (or unknown)
and adjust call sites to cast/assert to the concrete viewer type or update their
signatures to accept the new type.


export class Load3dService {
Expand Down Expand Up @@ -139,7 +148,9 @@ export class Load3dService {
.getCurrentBackgroundInfo()
if (sourceBackgroundInfo.type === 'image') {
const sourceNode = this.getNodeByLoad3d(source)
const sceneConfig = sourceNode?.properties?.['Scene Config'] as any
const sceneConfig = sourceNode?.properties?.['Scene Config'] as
| SceneConfig
| undefined
const backgroundPath = sceneConfig?.backgroundImage
if (backgroundPath) {
await target.setBackgroundImage(backgroundPath)
Expand Down Expand Up @@ -179,8 +190,9 @@ export class Load3dService {
await viewer.applyChanges()

// Sync configuration back to the node's UI
if ((node as any).syncLoad3dConfig) {
;(node as any).syncLoad3dConfig()
const load3DNode = node as Load3DNode
if (load3DNode.syncLoad3dConfig) {
load3DNode.syncLoad3dConfig()
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/types/litegraph-augmentation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import type {
LLink,
Size
} from '@/lib/litegraph/src/litegraph'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import type {
IBaseWidget,
TWidgetValue
} from '@/lib/litegraph/src/types/widgets'
import type { NodeId } from '@/platform/workflow/validation/schemas/workflowSchema'
import type { NodeExecutionOutput } from '@/schemas/apiSchema'
import type { ComfyNodeDef as ComfyNodeDefV2 } from '@/schemas/nodeDef/nodeDefSchemaV2'
Expand Down Expand Up @@ -210,6 +213,6 @@ declare module '@/lib/litegraph/src/litegraph' {
* used by litegraph internally. We should remove the dependency on it later.
*/
interface LGraphNode {
widgets_values?: unknown[]
widgets_values?: TWidgetValue[]
}
}
7 changes: 6 additions & 1 deletion src/utils/envUtil.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import type { ElectronAPI } from '@comfyorg/comfyui-electron-types'

// Extend Window interface to include electronAPI
type ElectronWindow = typeof window & {
electronAPI?: ElectronAPI
}

export function isElectron() {
return 'electronAPI' in window && window.electronAPI !== undefined
}

export function electronAPI() {
return (window as any).electronAPI as ElectronAPI
return (window as ElectronWindow).electronAPI as ElectronAPI
}

export function showNativeSystemMenu() {
Expand Down
18 changes: 11 additions & 7 deletions src/workbench/extensions/manager/stores/comfyManagerStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {
const managerQueue = useManagerQueue(taskHistory, taskQueue, installedPacks)

// Listen for task completion events to clean up installing state
useEventListener(app.api, 'cm-task-completed', (event: any) => {
const taskId = event.detail?.ui_id
if (taskId && taskIdToPackId.value.has(taskId)) {
const packId = taskIdToPackId.value.get(taskId)!
installingPacksIds.value.delete(packId)
taskIdToPackId.value.delete(taskId)
useEventListener(
app.api,
'cm-task-completed',
(event: CustomEvent<{ ui_id?: string }>) => {
const taskId = event.detail?.ui_id
if (taskId && taskIdToPackId.value.has(taskId)) {
const packId = taskIdToPackId.value.get(taskId)!
installingPacksIds.value.delete(packId)
taskIdToPackId.value.delete(taskId)
}
}
})
)

const setStale = () => {
isStale.value = true
Expand Down