Skip to content

fix: preserve flow content when renaming a flow#5801

Open
hztBUAA wants to merge 1 commit intoFlowiseAI:mainfrom
hztBUAA:fix/flow-rename-empty-overview
Open

fix: preserve flow content when renaming a flow#5801
hztBUAA wants to merge 1 commit intoFlowiseAI:mainfrom
hztBUAA:fix/flow-rename-empty-overview

Conversation

@hztBUAA
Copy link

@hztBUAA hztBUAA commented Feb 20, 2026

Summary

Fixes #5736 - Renaming a flow from the list view caused the flow overview to appear empty.

Root cause: saveFlowRename and saveFlowCategory in FlowListMenu used the useApi hook to call updateChatflow. The useApi hook's internal error handling calls ErrorContext.setError(), which shares state with the parent Chatflows page. If the update triggered any error (even transient), it would cause the page to render an ErrorBoundary instead of the flow list, making it appear empty.

Changes:

  • Call chatflowsApi.updateChatflow directly instead of through useApi, so errors are caught locally in try/catch without polluting the page-level error state
  • Close the rename dialog on success (setFlowDialogOpen(false)) — previously it stayed open after confirming
  • Send only the changed field ({ name } or { category }) in the request body — previously the entire chatflow object was unnecessarily included
  • Add optional chaining on error.response?.data to prevent crashes when the error lacks a response property

Test plan

  • Open Chatflows list view (table mode)
  • Click Options > Rename on any flow
  • Enter a new name and confirm
  • Verify the dialog closes and the list refreshes with the updated name
  • Verify the flow content is preserved (open the renamed flow in canvas)
  • Repeat for Update Category from the same menu
  • Repeat the above steps for Agentflows (both V1 and V2)

The FlowListMenu rename and category update functions had two issues:

1. The rename dialog was not closed after a successful rename, leaving
   the user in an ambiguous state.

2. Both saveFlowRename and saveFlowCategory used the useApi hook to call
   updateChatflow. The useApi hook's internal error handling calls
   ErrorContext.setError(), which causes the parent Chatflows page to
   render an ErrorBoundary instead of the flow list. By using
   chatflowsApi.updateChatflow directly, errors are properly caught in
   the local try/catch without polluting the page-level error state.

3. Both functions unnecessarily included the entire chatflow object in
   the update request body. Only the changed field (name or category)
   needs to be sent.

4. Added optional chaining on error.response?.data to prevent crashes
   when the error object lacks a response property.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hztBUAA, 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 addresses a critical bug where renaming or updating a flow's category would cause the flow overview to appear empty due to an issue with how API errors were propagated. The changes involve refactoring the API call mechanism to handle errors locally, optimizing the data sent in update requests, and enhancing the robustness of error message extraction, thereby ensuring the UI remains stable and responsive during these operations.

Highlights

  • Error Handling Refactor: Refactored API calls in FlowListMenu to directly use chatflowsApi.updateChatflow instead of the useApi hook, preventing page-level error state pollution and ensuring local error handling.
  • UI/UX Improvement: Ensured the rename dialog closes automatically upon successful flow renaming, improving user experience.
  • Optimized API Payload: Modified API requests for renaming and updating categories to send only the specific changed field (name or category) instead of the entire chatflow object.
  • Robust Error Messaging: Added optional chaining (?.) to error response data access to prevent crashes when the error object might lack a response property.
Changelog
  • packages/ui/src/ui-component/button/FlowListMenu.jsx
    • Removed the import and usage of the useApi hook.
    • Updated saveFlowRename to directly call chatflowsApi.updateChatflow with only the name field and to close the dialog on success.
    • Updated saveFlowCategory to directly call chatflowsApi.updateChatflow with only the category field.
    • Implemented optional chaining (?.) when accessing error.response.data in error handling blocks for both rename and category update functions.
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
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 effectively addresses the reported bug where renaming a flow caused the overview to appear empty. The changes correctly remove the useApi hook to prevent page-level error state pollution, ensure the rename dialog closes on success, and optimize API calls by sending only changed fields. The addition of optional chaining for error handling is a good practice.

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

packages/ui/src/ui-component/button/FlowListMenu.jsx (178-183)

medium

The updateBody object was created but only the name property was used in the updateChatflow call. This was unnecessary and has been correctly removed, simplifying the code.

packages/ui/src/ui-component/button/FlowListMenu.jsx (195)

medium

The addition of optional chaining (?.) to error.response?.data is a good practice. It prevents potential crashes if error.response is undefined or null, improving the robustness of error handling.

packages/ui/src/ui-component/button/FlowListMenu.jsx (230-232)

medium

Similar to the saveFlowRename function, the updateBody object was created but only the category property was used. Its removal simplifies the code and makes the API call more direct.

packages/ui/src/ui-component/button/FlowListMenu.jsx (238)

medium

The addition of optional chaining (?.) to error.response?.data is a good practice. It prevents potential crashes if error.response is undefined or null, improving the robustness of error handling.

@hztBUAA
Copy link
Author

hztBUAA commented Feb 25, 2026

Thanks for the review and feedback. I am following up on this PR now and will either push the requested changes or reply point-by-point shortly.

@hztBUAA
Copy link
Author

hztBUAA commented Feb 25, 2026

Quick follow-up: I am reviewing the feedback and will update this PR shortly.

@HenryHengZJ HenryHengZJ added the ui Issues or features related to ui label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui Issues or features related to ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a flow opens an empty flow overview

2 participants