File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
apps/studio/src/components Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,15 @@ const NumericInput = ({
4646 const num = clampValue ( isPositiveInteger ? parseInt ( string ) : parseFloat ( string ) )
4747 return isNaN ( num ) ? defaultValue : num
4848 } , [ isPositiveInteger , defaultValue , clampValue ] )
49- const numToString = useCallback ( ( value : number | null | undefined ) => value ?. toFixed ( isPositiveInteger ? 0 : 2 ) ?? "" , [ isPositiveInteger ] )
49+ const numToString = useCallback ( ( value : number | null | undefined ) => {
50+ if ( value === null || value === undefined ) {
51+ return ""
52+ }
53+ if ( value === 0 ) {
54+ value = 0 ; //This is to prevent -0 from showing up
55+ }
56+ return value . toFixed ( isPositiveInteger ? 0 : 2 )
57+ } , [ isPositiveInteger ] )
5058
5159 const [ typedValue , setTypedValue ] = useState ( numToString ( value ) )
5260 const [ isFocused , setIsFocused ] = useState ( false )
You can’t perform that action at this time.
0 commit comments