Repository navigation
fix(web): MCP edit dialog cancel/save buttons not closing - #17713
Conversation
The cancel button relied on Radix DialogClose, but the Modal swallows onOpenChange(false) when maskClosable is false, so clicking Cancel did nothing. Call hideModal directly on the cancel button instead. The save button stayed disabled on open because its gating only used the fresh test result while the tool list shown falls back to the stored tools. Unify both on the same fallback so the button state matches what is displayed; changing URL/server type/token still requires re-testing. Also drop the commented-out legacy Dialog implementation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe MCP edit dialog now selects tested tools when available and stored server tools otherwise. It uses the unified tool collection for counts and rendering. The cancel control directly invokes ChangesMCP edit dialog
Estimated code review effort: 2 (Simple) | ~10 minutes 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 |
wangq8
left a comment
There was a problem hiding this comment.
LGTM. Three clean fixes in one change:
-
Cancel button fix — The
Modalcomponent'shandleChangeswallowsonOpenChange(false)whenmaskClosableisfalse(set in #16449), soDialogClosehad no effect. UsinghideModaldirectly is the correct approach and matches what the X icon already does viahandleCancel. -
Tools fallback fix — Previously
toolsonly reflectedtestDataresults, while the UI displayed a fallback vianextTools. This mismatch made the save button appear disabled even though tools were shown. Nowtoolsitself does the fallback (testData?.data→ stored tools), sodisabledcorrectly reflects what the user sees. ThefieldChangedgate still requires re-testing after URL/server/token changes, which is correct. -
Dead code removal — Removes the commented-out legacy
Dialogimplementation. Always good to clean up.
No regressions, +13/-75 is a great cleanup ratio.
Summary
In user settings -> MCP, the edit MCP dialog could not be dismissed properly:
DialogClose, but theModalcomponent swallowsonOpenChange(false)in itshandleChangewhenmaskClosableisfalse(set in fix: user-setting modal fixes and DOMPurify cleanup #16449 to prevent accidental dismissal), sohideModalwas never called. Only the X icon (which goes throughhandleCancel) could close the dialog. The cancel button now callshideModaldirectly.disabledstate was gated only on the fresh test result (testData), while the tool list shown in the dialog falls back to the server's stored tools. On open, the dialog displayed the stored tools yet the save button stayed disabled until the user re-ran the test. Both now share the same fallback, so the button state matches what is displayed. Changing URL/server type/token still requires re-testing via the refresh button before saving (fieldChangedgate preserved).Also removes the commented-out legacy
Dialogimplementation left over from theModalmigration.