fix: stop TaskAddForm from freezing Code Review Defaults into new tasks - #6230
Merged
Conversation
…ks (#6219) ReviewerPicker never got a `defaults` prop on the task-creation path, so its onChange emitted a full snapshot every time and the submit payload unconditionally spread all eight reviewer fields whenever a task opened a PR with review-then-merge — even fields the user never touched. Every task created that way permanently pinned that moment's Code Review Defaults, deaf to later changes. Mirrors the #6208 fix already applied to GlobalConfigControls: track the fetched Code Review Defaults as a baseline (reviewDefaults) separate from what the user actually changed (reviewOverrides), pass the baseline as the picker's `defaults` prop so it only emits real overrides, and submit only the overridden keys (mapped to their task-metadata names).
Replaces the 8 repeated ...(overrides.k !== undefined ? {k: ...} : {})
ternaries with a single picker-key-to-payload-key map + a small helper,
mirroring GlobalConfigControls' REVIEWER_OVERRIDE_KEYS loop for the same
purpose. No behavior change.
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
TaskAddForm'sReviewerPickernever got adefaultsprop, so it always emitted a full snapshot, and the submit payload unconditionally spread all eight reviewer fields whenever a task opened a PR withreview-then-merge— freezing that moment's Code Review Defaults into the new task's metadata permanently, even for fields the user never touched.GlobalConfigControls.jsx(ReviewerPicker persists a defaults snapshot as a task override on first touch #6208): track the fetched Code Review Defaults as areviewDefaultsbaseline separate fromreviewOverrides(only what the user actually changed), pass the baseline asReviewerPicker'sdefaultsprop so itsonChangeonly ever emits a real diff, and submit only the overridden fields (mapped to their task-metadata names via a small lookup table).Test plan
TaskAddForm.test.jsx: submitting untouched leaves all 8 reviewer fields absent from the payload; touching one control (stop mode) sends only that field.cd client && npx vitest run src/components/cos/TaskAddForm.test.jsx src/components/cos/ReviewerPicker.test.jsx— 114 passed.npx biome lint --error-on-warningson the changed files — clean.Closes #6219