🧹 Refactor React Flow Node types in graphStore#4
Conversation
…ode type Removed hacky `[key: string]: unknown` index signature from `GraphNodeData`. Introduced `CustomNodeType` type alias to map the underlying data structure explicitly to the base React Flow `Node` generic type. Updated variable assignments and store methods to fully satisfy TypeScript constraints, eliminating build warnings and improving code health. Co-authored-by: harshithluc073 <101515387+harshithluc073@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: The code health issue addressed
The TypeScript type constraints regarding custom React Flow nodes in
GraphCanvas,CustomNode, andgraphStorewere causingtypecheckerrors. The nodedatapayload was incorrectly passing around standardNodeproperties.💡 Why: How this improves maintainability
Previously, to bypass strict type-checking,
GraphNodeDatahad an index signature[key: string]: unknown. This undermined type safety. ExtractingCustomNodeTypeas a specificNode<GraphNodeData, 'custom'>alias allows us to keepGraphNodeDataexactly representing only the backend graph node, increasing readability and guaranteeing type-safety.✅ Verification: How you confirmed the change is safe
Ran
npm run typecheck, resolved all generic parameter mismatched errors. Wrote and ran a Playwright script targeting the UI canvas to guarantee the visual structure rendered accurately and there were no layout regressions.✨ Result: The improvement achieved
A perfectly clean TypeScript compilation with zero errors, better typed Zustand store actions (
addNode,addNodes), and correctly typed UI components (useNodesState,useEdgesState), improving maintainability moving forward.PR created automatically by Jules for task 1934357711502236593 started by @harshithluc073