fix: allow clearing Max Count and Max Cost in Auto-Approve settings #9160
+0
−4
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.
Fixes the issue where clearing the "Max Count" or "Max Cost" fields in Auto-Approve settings would not persist after saving and navigating away.
Problem
When users cleared the Max Count or Max Cost input fields to return to "Unlimited" auto-approvals, the Save button would enable, but after clicking Save and navigating away from settings, the old value would still be present.
Root Cause
The
MaxRequestsInputandMaxCostInputcomponents were sendingvscode.postMessageimmediately on value change (in thehandleValueChangecallback). This created a race condition where:undefinedis sent via postMessageFormattedTextFieldblur handler reformats the display valueSolution
Removed the immediate
vscode.postMessagecalls from both components. The parentSettingsViewcomponent already handles sending all settings via postMessage when the Save button is clicked (line 338-339 in SettingsView.tsx). This ensures:Changes
vscode.postMessagefromMaxRequestsInput.handleValueChangevscode.postMessagefromMaxCostInput.handleValueChangevscodeimport from both filesTesting
Important
Fixes persistence issue for cleared "Max Count" and "Max Cost" fields in Auto-Approve settings by removing immediate
vscode.postMessagecalls.vscode.postMessagefromhandleValueChangeinMaxRequestsInputandMaxCostInput.vscodeimport from both components.MaxRequestsInput.spec.tsx).This description was created by
for cae5bc2. You can customize this summary. It will automatically update as commits are pushed.
Note
Removes
vscode.postMessageside-effects from Max Cost/Requests inputs so cleared values persist until explicitly saved.vscode.postMessagecalls fromhandleValueChangeinwebview-ui/src/components/settings/MaxCostInput.tsxandMaxRequestsInput.tsx.vscodeimports in both files.onValueChange, deferring persistence to the parent save flow.Written by Cursor Bugbot for commit ceaa3b7. This will update automatically on new commits. Configure here.