Skip to content

🧹 Refactor React Flow Node types in graphStore#4

Open
harshithluc073 wants to merge 1 commit intomainfrom
fix/react-flow-node-types-1934357711502236593
Open

🧹 Refactor React Flow Node types in graphStore#4
harshithluc073 wants to merge 1 commit intomainfrom
fix/react-flow-node-types-1934357711502236593

Conversation

@harshithluc073
Copy link
Owner

🎯 What: The code health issue addressed
The TypeScript type constraints regarding custom React Flow nodes in GraphCanvas, CustomNode, and graphStore were causing typecheck errors. The node data payload was incorrectly passing around standard Node properties.

💡 Why: How this improves maintainability
Previously, to bypass strict type-checking, GraphNodeData had an index signature [key: string]: unknown. This undermined type safety. Extracting CustomNodeType as a specific Node<GraphNodeData, 'custom'> alias allows us to keep GraphNodeData exactly 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

…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>
@google-labs-jules
Copy link

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant