-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: resolve save button activation in prompts settings (#5780) #6026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -56,14 +56,21 @@ const PromptsSettings = ({ customSupportPrompts, setCustomSupportPrompts }: Prom | |||||||||||
| }, []) | ||||||||||||
|
|
||||||||||||
| const updateSupportPrompt = (type: SupportPromptType, value: string | undefined) => { | ||||||||||||
| // Trim the value when storing, but keep empty strings | ||||||||||||
| const trimmedValue = value?.trim() | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty strings are converted to undefined; this can repopulate defaults while clearing. Keep '' during editing and only coerce to undefined on save.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trimming on every keystroke can remove intentional whitespace; trim only on save. |
||||||||||||
| const finalValue = trimmedValue === "" ? undefined : trimmedValue | ||||||||||||
|
Comment on lines
+59
to
+61
|
||||||||||||
| // Trim the value when storing, but keep empty strings | |
| const trimmedValue = value?.trim() | |
| const finalValue = trimmedValue === "" ? undefined : trimmedValue | |
| // Trim the value when storing, and treat empty strings as undefined | |
| const finalValue = value?.trim() || undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use nullish coalescing (??) instead of || for fallback so empty strings don’t revert to defaults.
Copilot
AI
Sep 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The fallback to supportPrompt.default.CONDENSE is duplicated. Consider extracting this to a variable to avoid repetition: const promptValue = finalValue || supportPrompt.default.CONDENSE.
Copilot
AI
Sep 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The fallback to supportPrompt.default.CONDENSE is duplicated. Consider extracting this to a variable to avoid repetition: const promptValue = finalValue || supportPrompt.default.CONDENSE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-CONDENSE branch sets [type]: finalValue even when undefined; delete the key instead to fall back and keep change detection predictable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setCustomInstructions uses value || undefined; use value ?? undefined to preserve empty strings.