File tree Expand file tree Collapse file tree
frontend/testing-view/src/features/keyBindings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,7 +116,16 @@ export const AddKeyBindingDialog = ({
116116 setParameterValues ( ( prev ) => ( { ...prev , [ fieldId ] : value } ) ) ;
117117 } ;
118118
119- const canSubmit = selectedCommandId !== null && capturedKey !== "" ;
119+ const hasInvalidNumericParams =
120+ selectedCommand !== null &&
121+ selectedCommand !== undefined &&
122+ Object . entries ( selectedCommand . fields ) . some (
123+ ( [ key , field ] ) =>
124+ field . kind === "numeric" && isNaN ( parseFloat ( parameterValues [ key ] ) ) ,
125+ ) ;
126+
127+ const canSubmit =
128+ selectedCommandId !== null && capturedKey !== "" && ! hasInvalidNumericParams ;
120129
121130 return (
122131 < Dialog open = { open } onOpenChange = { onOpenChange } >
Original file line number Diff line number Diff line change @@ -100,8 +100,18 @@ export const useGlobalKeyBindings = () => {
100100 ] ;
101101 }
102102
103+ const numericValue =
104+ field . kind === "numeric" ? parseFloat ( value ) : value ;
105+
106+ if ( field . kind === "numeric" && isNaN ( numericValue as number ) ) {
107+ logger . testingView . warn (
108+ `Skipping command: numeric field "${ fieldKey } " has no valid value` ,
109+ ) ;
110+ return acc ;
111+ }
112+
103113 acc [ fieldKey ] = {
104- value : field . kind === "numeric" ? parseFloat ( value ) : value ,
114+ value : numericValue ,
105115 isEnabled : true ,
106116 type : field . type ,
107117 } ;
You can’t perform that action at this time.
0 commit comments