fix: agentflow list refresh after deletion (Issue #5360)
Root Cause: When deleting an Agentflow from the list view, updateFlowsApi.request() was called without pagination parameters. This caused the backend to return a plain array instead of the expected { data: [], total: 0 } format, leading to a TypeError when accessing .data.length.
Solution:
- Created refreshAgentflows callback that includes current pagination state
- Passed callback through FlowListTable to FlowListMenu
- Updated handleDelete to use callback instead of direct API call
- Maintains backward compatibility for components without callback
Note : This change is backward compatible will not break existing delete functionality cheers !
Fixes #5360
Summary of Changes
Hello @aibysid, I'm Gemini Code Assist[^1]! 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 in the Agentflow list view where deleting an item would lead to a UI error due to an unexpected API response format. The solution introduces a more robust and flexible refresh mechanism that correctly updates the list post-deletion, ensuring data consistency and a smoother user experience. It also improves error handling and maintains backward compatibility.
Highlights
- Bug Fix: Agentflow Deletion Refresh: Resolved an issue where deleting an Agentflow caused a TypeError due to the backend returning an unpaginated array instead of the expected paginated object format. This ensures the list refreshes correctly after deletion.
-
New Refresh Callback Mechanism: Introduced an
onRefreshcallback prop, passed down from theAgentflowsview throughFlowListTabletoFlowListMenu. This callback now handles refreshing the agentflow list while preserving the current pagination state. -
Backward Compatibility: The
handleDeletefunction inFlowListMenunow prioritizes the newonRefreshcallback but falls back to the existingupdateFlowsApi.requestifonRefreshis not provided, ensuring no breakage for components without the new callback. -
Robust Data Handling: Added a safety check in the
Agentflowscomponent to gracefully handle both array and object response formats from thegetAllAgentflowsAPI, preventing potential errors from inconsistent API responses. -
Improved Error Logging: Enhanced error logging within the
Agentflowscomponent to provide more detailed information, including the problematic data and error stack, when processing agentflow data fails.
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 :thumbsup: and :thumbsdown: 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.
[^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.
@aibysid thank you so much for all the PR! We'll get these reviewed ASAP!