Fix manual entry within Quantity Inputs (https://github.com/woocommerce/woocommerce-blocks/pull/5197)
* Use Number.isNaN to cast strings * Avoid changing type function
This commit is contained in:
parent
91008a6492
commit
128ef97010
|
@ -6,7 +6,6 @@ import { speak } from '@wordpress/a11y';
|
|||
import classNames from 'classnames';
|
||||
import { useCallback } from '@wordpress/element';
|
||||
import { DOWN, UP } from '@wordpress/keycodes';
|
||||
import { isNumber } from '@woocommerce/types';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -84,7 +83,8 @@ const QuantitySelector = ( {
|
|||
onKeyDown={ quantityInputOnKeyDown }
|
||||
onChange={ ( event ) => {
|
||||
let value =
|
||||
! isNumber( event.target.value ) || ! event.target.value
|
||||
Number.isNaN( event.target.value ) ||
|
||||
! event.target.value
|
||||
? 0
|
||||
: parseInt( event.target.value, 10 );
|
||||
if ( hasMaximum ) {
|
||||
|
|
Loading…
Reference in New Issue