Skip to content

fix(site): fix disappearing preset selector when switching template#20514

Merged
DanielleMaywood merged 4 commits into
mainfrom
danielle/fix/preset-selector
Oct 29, 2025
Merged

fix(site): fix disappearing preset selector when switching template#20514
DanielleMaywood merged 4 commits into
mainfrom
danielle/fix/preset-selector

Conversation

@DanielleMaywood
Copy link
Copy Markdown
Contributor

@DanielleMaywood DanielleMaywood commented Oct 28, 2025

Closes #20465

Ensure we set selectedPresetId to undefined when we change selectedTemplateId to ensure we don't end up breaking the <Select> component by giving it an invalid preset id.

@DanielleMaywood DanielleMaywood marked this pull request as ready for review October 28, 2025 14:31
Copy link
Copy Markdown
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

LGTM, but will happily defer to other reviewers' feedback.

@aslilac
Copy link
Copy Markdown
Member

aslilac commented Oct 28, 2025

the key was added to intentionally unmount the state of the old selector, so that it would be recomputed with a default from the new set of values.

@DanielleMaywood
Copy link
Copy Markdown
Contributor Author

@aslilac I've re-added the key but added a check on the onValueChange. Let me know if you want a different approach

Copy link
Copy Markdown
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

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

I'm fine with this fix, but left some food for thought and would like to see a comment or something describing the pitfalls that the fix is supposed to smooth over

Comment thread site/src/modules/tasks/TaskPrompt/TaskPrompt.tsx Outdated
@johnstcn johnstcn added the cherry-pick/v2.28 Needs to be cherry-picked to the 2.28 release branch label Oct 29, 2025
@DanielleMaywood DanielleMaywood merged commit 9629d87 into main Oct 29, 2025
28 checks passed
@DanielleMaywood DanielleMaywood deleted the danielle/fix/preset-selector branch October 29, 2025 21:11
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cherry-pick/v2.28 Needs to be cherry-picked to the 2.28 release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coder Tasks presets not set correctly when switching between templates

3 participants