@@ -33,12 +33,34 @@ import {
3333} from '@/store/ports'
3434import { NodeResizeControl , ResizeControlVariant } from '@xyflow/react'
3535import { useUnit } from 'effector-react'
36- import { memo , useCallback , useEffect , useMemo , useState } from 'react'
36+ import { memo , useCallback , useMemo } from 'react'
3737import { BreakpointButton } from '../debug/BreakpointButton'
3838import NodeBody from './NodeBody'
3939import NodeErrorPorts from './NodeErrorPorts'
4040import { NodeHeader } from './NodeHeader'
4141
42+ const defaultCategoryMetadata = {
43+ id : 'other' ,
44+ label : 'Other' ,
45+ description : 'Other nodes' ,
46+ icon : 'Package' ,
47+ style : {
48+ light : {
49+ primary : '#F5F5F5' , // Soft gray
50+ secondary : '#FAFAFA' ,
51+ background : '#FFFFFF' ,
52+ text : '#616161' , // Darker gray
53+ } ,
54+ dark : {
55+ primary : '#2C2C2C' ,
56+ secondary : '#1F1F1F' ,
57+ background : '#1C1C1C' ,
58+ text : '#BDBDBD' ,
59+ } ,
60+ } ,
61+ order : 7 ,
62+ }
63+
4264function ChaingraphNodeComponent ( {
4365 data,
4466 selected,
@@ -61,9 +83,11 @@ function ChaingraphNodeComponent({
6183 const nodeEdges = useEdgesForNode ( id )
6284 const highlightedNodeId = useUnit ( $highlightedNodeId )
6385
64- const [ style , setStyle ] = useState (
65- theme === 'dark' ? data . categoryMetadata . style . dark : data . categoryMetadata . style . light ,
66- )
86+ const categoryMetadata = data . categoryMetadata ?? defaultCategoryMetadata
87+
88+ const style = useMemo ( ( ) => {
89+ return theme === 'dark' ? categoryMetadata . style . dark : categoryMetadata . style . light
90+ } , [ categoryMetadata , theme ] )
6791
6892 const isHighlighted = useMemo (
6993 ( ) => highlightedNodeId && highlightedNodeId . includes ( id ) ,
@@ -104,12 +128,6 @@ function ChaingraphNodeComponent({
104128 }
105129 } , [ isBreakpointSet , dispatch , id ] )
106130
107- useEffect ( ( ) => {
108- setStyle (
109- theme === 'dark' ? data . categoryMetadata . style . dark : data . categoryMetadata . style . light ,
110- )
111- } , [ theme , data . categoryMetadata , id ] )
112-
113131 // Use throttled/memoized version of execution state style to reduce renders
114132 const executionStateStyle = useMemo ( ( ) => {
115133 // Calculate the style based on node state
@@ -217,7 +235,7 @@ function ChaingraphNodeComponent({
217235 < NodeHeader
218236 node = { nodeExecution ?. node ?? node }
219237 context = { portContextValue }
220- icon = { data . categoryMetadata . icon }
238+ icon = { categoryMetadata . icon }
221239 style = { style }
222240 onDelete = { ( ) => removeNodeFromFlow ( {
223241 flowId : activeFlow . id ! ,
0 commit comments