@@ -12,6 +12,8 @@ import type { SchemaAnalysisState } from '../../schema-analysis-types';
1212import  numeral  from  'numeral' ; 
1313import  {  DEFAULT_DOCUMENT_COUNT ,  MAX_DOCUMENT_COUNT  }  from  './constants' ; 
1414
15+ const  BYTE_PRECISION_THRESHOLD  =  1000 ; 
16+ 
1517const  titleStyles  =  css ( { 
1618  fontWeight : 600 , 
1719} ) ; 
@@ -38,7 +40,7 @@ const boldStyles = css({
3840} ) ; 
3941
4042const  formatBytes  =  ( bytes : number )  =>  { 
41-   const  precision  =  bytes  <=  1000  ? '0'  : '0.0' ; 
43+   const  precision  =  bytes  <=  BYTE_PRECISION_THRESHOLD  ? '0'  : '0.0' ; 
4244  return  numeral ( bytes ) . format ( precision  +  'b' ) ; 
4345} ; 
4446
@@ -90,6 +92,15 @@ const DocumentCountScreen = ({
9092    } ; 
9193  } ,  [ isOutOfRange ] ) ; 
9294
95+   const  handleDocumentCountChange  =  ( 
96+     event : React . ChangeEvent < HTMLInputElement > 
97+   )  =>  { 
98+     const  value  =  parseInt ( event . target . value ,  10 ) ; 
99+     if  ( ! isNaN ( value ) )  { 
100+       onDocumentCountChange ( value ) ; 
101+     } 
102+   } ; 
103+ 
93104  return  schemaAnalysisState . status  ===  'complete'  ? ( 
94105    < div > 
95106      < Body  className = { titleStyles } > 
@@ -105,7 +116,7 @@ const DocumentCountScreen = ({
105116          label = "Documents to generate in current collection" 
106117          type = "number" 
107118          value = { documentCount . toString ( ) } 
108-           onChange = { ( e )   =>   onDocumentCountChange ( Number ( e . target . value ) ) } 
119+           onChange = { handleDocumentCountChange } 
109120          min = { 1 } 
110121          max = { MAX_DOCUMENT_COUNT } 
111122          state = { errorState . state } 
0 commit comments