@@ -33,13 +33,35 @@ 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 { useElementResize } from './hooks/useElementResize'
3939import NodeBody from './NodeBody'
4040import NodeErrorPorts from './NodeErrorPorts'
4141import { NodeHeader } from './NodeHeader'
4242
43+ const defaultCategoryMetadata = {
44+ id : 'other' ,
45+ label : 'Other' ,
46+ description : 'Other nodes' ,
47+ icon : 'Package' ,
48+ style : {
49+ light : {
50+ primary : '#F5F5F5' , // Soft gray
51+ secondary : '#FAFAFA' ,
52+ background : '#FFFFFF' ,
53+ text : '#616161' , // Darker gray
54+ } ,
55+ dark : {
56+ primary : '#2C2C2C' ,
57+ secondary : '#1F1F1F' ,
58+ background : '#1C1C1C' ,
59+ text : '#BDBDBD' ,
60+ } ,
61+ } ,
62+ order : 7 ,
63+ }
64+
4365function ChaingraphNodeComponent ( {
4466 data,
4567 selected,
@@ -62,9 +84,11 @@ function ChaingraphNodeComponent({
6284 const nodeEdges = useEdgesForNode ( id )
6385 const highlightedNodeId = useUnit ( $highlightedNodeId )
6486
65- const [ style , setStyle ] = useState (
66- theme === 'dark' ? data . categoryMetadata . style . dark : data . categoryMetadata . style . light ,
67- )
87+ const categoryMetadata = data . categoryMetadata ?? defaultCategoryMetadata
88+
89+ const style = useMemo ( ( ) => {
90+ return theme === 'dark' ? categoryMetadata . style . dark : categoryMetadata . style . light
91+ } , [ categoryMetadata , theme ] )
6892
6993 const isHighlighted = useMemo (
7094 ( ) => highlightedNodeId && highlightedNodeId . includes ( id ) ,
@@ -105,12 +129,6 @@ function ChaingraphNodeComponent({
105129 }
106130 } , [ isBreakpointSet , dispatch , id ] )
107131
108- useEffect ( ( ) => {
109- setStyle (
110- theme === 'dark' ? data . categoryMetadata . style . dark : data . categoryMetadata . style . light ,
111- )
112- } , [ theme , data . categoryMetadata , id ] )
113-
114132 // Use throttled/memoized version of execution state style to reduce renders
115133 const executionStateStyle = useMemo ( ( ) => {
116134 // Calculate the style based on node state
@@ -252,7 +270,7 @@ function ChaingraphNodeComponent({
252270 < NodeHeader
253271 node = { nodeExecution ?. node ?? node }
254272 context = { portContextValue }
255- icon = { data . categoryMetadata . icon }
273+ icon = { categoryMetadata . icon }
256274 style = { style }
257275 onDelete = { ( ) => removeNodeFromFlow ( {
258276 flowId : activeFlow . id ! ,
0 commit comments