Skip to content

Commit

Permalink
Handle group node
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Sep 12, 2024
1 parent 691084b commit 2590487
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/extensions/core/nodeBadge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import type { Palette } from '@/types/colorPalette'
function getNodeSource(node: ComfyLGraphNode) {
const pythonModule = (node.constructor as typeof ComfyLGraphNode).nodeData
?.python_module
return getNodeSourceFromPythonModule(pythonModule)
return pythonModule ? getNodeSourceFromPythonModule(pythonModule) : null
}

function isCoreNode(node: ComfyLGraphNode) {
return getNodeSource(node).type === 'core'
return getNodeSource(node)?.type === 'core'
}

function getNodeIdBadge(node: ComfyLGraphNode, nodeIdBadgeMode: NodeBadgeMode) {
Expand All @@ -38,11 +38,11 @@ function getNodeSourceBadge(
return nodeSourceBadgeMode === NodeBadgeMode.None ||
(isCoreNode(node) && nodeSourceBadgeMode === NodeBadgeMode.HideBuiltIn)
? ''
: nodeSource.badgeText
: nodeSource?.badgeText ?? ''
}

class NodeSourceBadgeExtension implements ComfyExtension {
name = 'Comfy.NodeSourceBadge'
class NodeBadgeExtension implements ComfyExtension {
name = 'Comfy.NodeBadge'

constructor(
public nodeIdBadgeMode: ComputedRef<NodeBadgeMode> | null = null,
Expand Down Expand Up @@ -114,4 +114,4 @@ class NodeSourceBadgeExtension implements ComfyExtension {
}
}

app.registerExtension(new NodeSourceBadgeExtension())
app.registerExtension(new NodeBadgeExtension())

0 comments on commit 2590487

Please sign in to comment.