fix(DIARCHERS-1547): MCP trigger toggle is a no-op on first click#629
Merged
Merged
Conversation
The md-switch @change fired before v-model wrote the new value back to token.allow_trigger, so toggleMcpTrigger read the stale value and sent the current (unchanged) state to the backend — the first click was a no-op and the toggle only appeared to work on the second click. Use the new value emitted by @change ($event) instead of reading token.allow_trigger, matching the existing pattern in AdminClusters.vue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a frontend bug on the User Settings → MCP Tokens page where the
per-token Trigger switch did nothing on the first click. Users had to
click it twice (and refresh) before
allow_triggeractually changed on thebackend.
Root cause
The
md-switch@changehandler fired beforev-modelhad written thenew value back to
token.allow_trigger.toggleMcpTriggerthen read thatstale value and sent it to the backend:
setMcpTriggerpicks the HTTP method from that value(
allow ? POST : DELETE), so the first click sent the current state — ano-op. The second click read the value left over from the previous
interaction and only then appeared to work.
Fix
Use the new value emitted by
@change($event) instead of readingtoken.allow_trigger, and keep the local model in sync with it. Thismatches the existing, working pattern in
AdminClusters.vue(
@change="setCluster(c.name, $event)").Impact
disabled trigger permission while the backend still allowed builds to be
triggered.
(
POST/DELETE /api/v1/mcp/tokens/<id>/trigger) was already correct(verified via curl and end-to-end through the MCP client).
Testing
(verified against test/prod build after deploy).