Skip to content

feat(agentflow): wire functionality to edit nodes#5786

Merged
j-sanaa merged 19 commits intomainfrom
feat/wire-editNodeDialog
Feb 21, 2026
Merged

feat(agentflow): wire functionality to edit nodes#5786
j-sanaa merged 19 commits intomainfrom
feat/wire-editNodeDialog

Conversation

@j-sanaa
Copy link
Copy Markdown
Contributor

@j-sanaa j-sanaa commented Feb 19, 2026

  • Double click on a node to open node edit dialog
  • New icon added in node toolbar for edit
  • persist values on closing the node editor dialog
Screen.Recording.2026-02-20.at.10.44.41.AM.mov

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @j-sanaa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant new feature allowing users to edit the properties of individual nodes within the Agentflow canvas. This is achieved through a new EditNodeDialog that can be triggered by double-clicking a node or by clicking a newly added edit icon in the node's toolbar. The changes include comprehensive updates to the application's state management to handle the dialog's lifecycle and data persistence, alongside a refactoring of how node input changes are processed. Additionally, the development environment for the examples has been updated with a Vite proxy to facilitate API interactions.

Highlights

  • Node Editing Functionality: Introduced the ability to edit nodes via a dedicated dialog, accessible through a double-click on a node or a new edit icon in the node toolbar.
  • Centralized State Management: Implemented new state properties (editingNodeId, editDialogProps) and actions (OPEN_EDIT_DIALOG, CLOSE_EDIT_DIALOG) within the AgentflowContext to manage the node editing dialog's state.
  • Improved Node Input Handling: Refactored NodeInputHandler to use a callback for data changes, promoting a more controlled and predictable state update mechanism.
  • Development Environment Enhancements: Configured a Vite proxy for /api calls in the example application, streamlining API interactions during development.
Changelog
  • packages/agentflow/examples/src/config.ts
    • Updated the default apiBaseUrl to an empty string, preparing for proxy usage.
  • packages/agentflow/examples/vite.config.ts
  • packages/agentflow/src/Agentflow.tsx
    • Integrated the EditNodeDialog component.
    • Added useEffect hooks to synchronize ReactFlow's local node/edge states with the global context.
  • packages/agentflow/src/atoms/NodeInputHandler.tsx
    • Modified the handleDataChange callback to pass inputParam and newValue directly, removing direct data mutation.
  • packages/agentflow/src/core/types/index.ts
    • Extended AgentflowState with editingNodeId and editDialogProps.
    • Added OPEN_EDIT_DIALOG and CLOSE_EDIT_DIALOG actions.
  • packages/agentflow/src/features/canvas/components/NodeToolbarActions.tsx
    • Added an 'Edit' icon button to the node toolbar, which triggers the node editor dialog.
  • packages/agentflow/src/features/canvas/containers/AgentFlowNode.tsx
    • Implemented double-click functionality on nodes to open the node editor dialog.
    • Integrated the useOpenNodeEditor hook.
  • packages/agentflow/src/features/canvas/hooks/index.ts
    • Exported the new useOpenNodeEditor hook.
  • packages/agentflow/src/features/canvas/hooks/useOpenNodeEditor.ts
    • Added a new hook useOpenNodeEditor to centralize the logic for preparing and opening the node editing dialog.
  • packages/agentflow/src/infrastructure/store/AgentflowContext.tsx
    • Introduced openEditDialog and closeEditDialog functions to the context, providing methods to control the node editor dialog.
  • packages/agentflow/src/infrastructure/store/agentflowReducer.test.ts
    • Added new test cases for the OPEN_EDIT_DIALOG and CLOSE_EDIT_DIALOG actions.
    • Updated the initial state for testing to include new dialog-related fields.
  • packages/agentflow/src/infrastructure/store/agentflowReducer.ts
    • Implemented the reducer logic for OPEN_EDIT_DIALOG and CLOSE_EDIT_DIALOG actions, managing the state of the node editing dialog.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces node editing functionality, including a new dialog and toolbar actions. The implementation is functional but contains a critical issue in Agentflow.tsx where a circular update loop is created between local and global states. There are also several unused variables and minor cleanup opportunities in the new hooks and components.

Comment on lines 30 to 32
const { openEditDialog } = useAgentflowContext()
const { availableNodes } = useFlowNodes()
const ref = useRef<HTMLDivElement>(null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The variables openEditDialog and availableNodes are destructured from their respective hooks but are not used within this component. They should be removed to keep the component clean.

Suggested change
const { openEditDialog } = useAgentflowContext()
const { availableNodes } = useFlowNodes()
const ref = useRef<HTMLDivElement>(null)
const ref = useRef<HTMLDivElement>(null)

@j-sanaa j-sanaa marked this pull request as ready for review February 20, 2026 17:17
@j-sanaa j-sanaa requested a review from VaidikFlow February 20, 2026 17:24
@j-sanaa j-sanaa marked this pull request as draft February 20, 2026 18:55
@j-sanaa
Copy link
Copy Markdown
Contributor Author

j-sanaa commented Feb 20, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully implements the node editing functionality, including the UI triggers (double-click and toolbar icon) and the underlying state management. The refactoring of inputs to inputValues correctly distinguishes between parameter definitions and user-provided data. However, there are some concerns regarding state management practices, specifically direct prop mutation in the StickyNote component and the brittle synchronization logic in the main Agentflow component. Addressing these will improve the stability and maintainability of the application.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully implements the node editing functionality, including a new edit dialog, a toolbar button, and double-click support. The refactoring of inputs to inputValues to separate input definitions from their values is a great improvement for code clarity. I've identified a few areas for improvement: a complex state synchronization logic in Agentflow.tsx that could be simplified, a direct state mutation in StickyNote.tsx, and a potential UI flicker in the EditNodeDialog due to a removed cleanup function. Addressing these points will improve the robustness and maintainability of the new feature.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/agentflow/src/Agentflow.tsx (78-119)

high

The current implementation for synchronizing state between React Flow's internal state (useNodesState, useEdgesState) and the AgentflowContext is quite complex. Using refs (syncingToContext, syncingFromContext) and setTimeout to prevent circular updates can be brittle and hard to maintain. A more robust and standard approach with React Flow is to use a single source of truth. The AgentflowContext should be the single source of truth for nodes and edges. The AgentflowCanvas component can then consume this state directly without needing its own local state via useNodesState/useEdgesState. Changes from React Flow (like node drags) can be dispatched to the context reducer using the onNodesChange and onEdgesChange callbacks combined with applyNodeChanges and applyEdgeChanges helpers from React Flow. This would eliminate the need for the complex two-way sync logic and make the state management more predictable.

packages/agentflow/src/features/canvas/containers/StickyNote.tsx (60-64)

high

The onChange handler directly mutates the data.inputValues property of the data prop. This is an anti-pattern in React and can lead to unpredictable rendering. Instead, you should treat props as immutable and use a state update function to propagate changes. You can use the updateNodeData function from useAgentflowContext to correctly update the node's data in the central store. You'll need to import useAgentflowContext and get updateNodeData from it.

                        onChange={(e) => {
                            if (inputParam) {
                                updateNodeData(data.id, {
                                    inputValues: {
                                        ...data.inputValues,
                                        [inputParam.name]: e.target.value
                                    }
                                })
                            }
                        }}

packages/agentflow/src/features/node-editor/EditNodeDialog.tsx (68-71)

medium

This cleanup function was useful for resetting the dialog's state. Its removal could lead to a UI flicker where old data is briefly shown when opening the dialog for a new node. I'd recommend keeping this cleanup logic to ensure the dialog always starts with a fresh state. You might also consider resetting nodeName here for completeness.

@FlowiseAI FlowiseAI deleted a comment from gemini-code-assist bot Feb 20, 2026
@j-sanaa j-sanaa marked this pull request as ready for review February 20, 2026 20:03
@j-sanaa j-sanaa merged commit d09387b into main Feb 21, 2026
7 checks passed
@j-sanaa j-sanaa deleted the feat/wire-editNodeDialog branch February 24, 2026 00:56
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.

2 participants