Skip to content

Commit f913f9c

Browse files
committed
fix: resolve save button activation in prompts settings (#5780)
- Replace logical OR (||) with nullish coalescing (??) in onChange handlers - Fixes issue where empty strings were treated as falsy, preventing proper event handling - Applied fix to PromptsSettings.tsx and 5 similar instances in ModesView.tsx - Ensures Save button activates immediately when editing prompt text
1 parent 9fce90b commit f913f9c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

webview-ui/src/components/modes/ModesView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
833833
})()}
834834
onChange={(e) => {
835835
const value =
836-
(e as unknown as CustomEvent)?.detail?.target?.value ||
836+
(e as unknown as CustomEvent)?.detail?.target?.value ??
837837
((e as any).target as HTMLTextAreaElement).value
838838
const customMode = findModeBySlug(visualMode, customModes)
839839
if (customMode) {
@@ -888,7 +888,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
888888
})()}
889889
onChange={(e) => {
890890
const value =
891-
(e as unknown as CustomEvent)?.detail?.target?.value ||
891+
(e as unknown as CustomEvent)?.detail?.target?.value ??
892892
((e as any).target as HTMLTextAreaElement).value
893893
const customMode = findModeBySlug(visualMode, customModes)
894894
if (customMode) {
@@ -943,7 +943,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
943943
})()}
944944
onChange={(e) => {
945945
const value =
946-
(e as unknown as CustomEvent)?.detail?.target?.value ||
946+
(e as unknown as CustomEvent)?.detail?.target?.value ??
947947
((e as any).target as HTMLTextAreaElement).value
948948
const customMode = findModeBySlug(visualMode, customModes)
949949
if (customMode) {
@@ -1102,7 +1102,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
11021102
})()}
11031103
onChange={(e) => {
11041104
const value =
1105-
(e as unknown as CustomEvent)?.detail?.target?.value ||
1105+
(e as unknown as CustomEvent)?.detail?.target?.value ??
11061106
((e as any).target as HTMLTextAreaElement).value
11071107
const customMode = findModeBySlug(visualMode, customModes)
11081108
if (customMode) {
@@ -1307,7 +1307,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
13071307
value={customInstructions || ""}
13081308
onChange={(e) => {
13091309
const value =
1310-
(e as unknown as CustomEvent)?.detail?.target?.value ||
1310+
(e as unknown as CustomEvent)?.detail?.target?.value ??
13111311
((e as any).target as HTMLTextAreaElement).value
13121312
setCustomInstructions(value || undefined)
13131313
vscode.postMessage({

webview-ui/src/components/settings/PromptsSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const PromptsSettings = ({ customSupportPrompts, setCustomSupportPrompts }: Prom
147147
value={getSupportPromptValue(activeSupportOption)}
148148
onChange={(e) => {
149149
const value =
150-
(e as unknown as CustomEvent)?.detail?.target?.value ||
150+
(e as unknown as CustomEvent)?.detail?.target?.value ??
151151
((e as any).target as HTMLTextAreaElement).value
152152
const trimmedValue = value.trim()
153153
updateSupportPrompt(activeSupportOption, trimmedValue || undefined)

0 commit comments

Comments
 (0)