Skip to content

fix(web): MCP edit dialog cancel/save buttons not closing - #17713

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
euvre:fix/mcp-edit-dialog-close-buttons
Aug 3, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
euvre:fix/mcp-edit-dialog-close-buttons

Conversation

@euvre

@euvre euvre commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

In user settings -> MCP, the edit MCP dialog could not be dismissed properly:

  • Cancel did nothing. The footer's cancel button relied on Radix DialogClose, but the Modal component swallows onOpenChange(false) in its handleChange when maskClosable is false (set in fix: user-setting modal fixes and DOMPurify cleanup #16449 to prevent accidental dismissal), so hideModal was never called. Only the X icon (which goes through handleCancel) could close the dialog. The cancel button now calls hideModal directly.
  • Save appeared unresponsive. The save button's disabled state 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 (fieldChanged gate preserved).

Also removes the commented-out legacy Dialog implementation left over from the Modal migration.

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.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. 🧰 typescript Pull requests that update Typescript code labels Aug 3, 2026
@euvre euvre added the ci Continue Integration label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c70af0f-782a-4451-8871-b66c0db6c0f1

📥 Commits

Reviewing files that changed from the base of the PR and between 194f75f and c963ef5.

📒 Files selected for processing (1)
  • web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx

📝 Walkthrough

Walkthrough

The 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 hideModal.

Changes

MCP edit dialog

Layer / File(s) Summary
Unified tool collection
web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx
The dialog prefers nonempty tested tools and falls back to stored server tools. Tool counts and cards use the unified collection.
Direct cancellation
web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx
The cancel button directly calls hideModal, and the unused DialogClose import is removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: jay77721

Poem

I’m a rabbit with tools in a row,
Tested ones lead when they show.
Stored ones stand by,
Cards count nearby,
And cancel hops straight as I go.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the MCP edit dialog button issue addressed by the pull request.
Description check ✅ Passed The description includes the required Summary section and clearly explains the cancel and save button fixes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@euvre
euvre requested a review from wangq8 August 3, 2026 04:19

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Three clean fixes in one change:

  1. Cancel button fix — The Modal component's handleChange swallows onOpenChange(false) when maskClosable is false (set in #16449), so DialogClose had no effect. Using hideModal directly is the correct approach and matches what the X icon already does via handleCancel.

  2. Tools fallback fix — Previously tools only reflected testData results, while the UI displayed a fallback via nextTools. This mismatch made the save button appear disabled even though tools were shown. Now tools itself does the fallback (testData?.data → stored tools), so disabled correctly reflects what the user sees. The fieldChanged gate still requires re-testing after URL/server/token changes, which is correct.

  3. Dead code removal — Removes the commented-out legacy Dialog implementation. Always good to clean up.

No regressions, +13/-75 is a great cleanup ratio.

@wangq8
wangq8 requested a review from dcc123456 August 3, 2026 05:51
@wangq8
wangq8 merged commit 8b83c52 into infiniflow:main Aug 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files. 🧰 typescript Pull requests that update Typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants