Repository navigation
fix: prevent exporting empty MCP server selection - #16589
Conversation
Guard useExportMcp against empty id arrays, warn the user, and make the single-server parameter optional so bulk export works correctly. Add corresponding i18n keys for zh and en.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds an empty-selection guard to the MCP export hook that shows a localized warning instead of exporting, makes the ChangesMCP Export Guard
Estimated code review effort: 1 (Trivial) | ~5 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant useExportMcp
participant i18n
participant exportMcpServer
User->>useExportMcp: trigger export(ids, mcp)
alt ids is empty
useExportMcp->>i18n: get mcp.noServerSelected
useExportMcp-->>User: show warning message
else ids provided
useExportMcp->>exportMcpServer: exportMcpServer(ids)
exportMcpServer-->>useExportMcp: data.code === 0
useExportMcp-->>User: downloadJsonFile(mcp?.name or 'mcp')
end
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
This PR fixes a bug in the MCP server batch management UI where clicking Export without selecting any MCP server would still call the backend and download an empty JSON file. Now, if no server is selected, a warning is shown and the export is aborted.
Changes
Related issue
None.