Skip to content

Commit

Permalink
only spread props if its spreadable
Browse files Browse the repository at this point in the history
  • Loading branch information
nerrad committed Jul 13, 2018
1 parent e7b36d8 commit bc25fac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/range-control/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { isFinite } from 'lodash';
import { isFinite, isEmpty } from 'lodash';
import classnames from 'classnames';

/**
Expand Down Expand Up @@ -32,9 +32,10 @@ function RangeControl( {
const id = `inspector-range-control-${ instanceId }`;
const onChangeValue = ( event ) => onChange( Number( event.target.value ) );
const initialSliderValue = isFinite( value ) ? value : initialPosition || '';

// remove any fowardedRef that may be in here.
const forwardedProps = Object.assign( {}, ...props );
// remove any forwardedRef that may be in here.
const forwardedProps = ! isEmpty( props ) ?
Object.assign( {}, ...props ) :
props;
delete( forwardedProps.forwardedRef );

return (
Expand Down

0 comments on commit bc25fac

Please sign in to comment.