Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
UNSAFE_componentWillReceiveProps( nextProps ) {
if (
this.props.siteId === nextProps.siteId &&
this.props.postId === nextProps.postId &&
isShallowEqual( this.props.query, nextProps.query )
) {
return;
}
this.request( nextProps );
}
if ( isObject( element ) && hasFilter( 'blocks.getSaveContent.extraProps' ) ) {
/**
* Filters the props applied to the block save result element.
*
* @param {Object} props Props applied to save element.
* @param {WPBlockType} blockType Block type definition.
* @param {Object} attributes Block attributes.
*/
const props = applyFilters(
'blocks.getSaveContent.extraProps',
{ ...element.props },
blockType,
attributes
);
if ( ! isShallowEqual( props, element.props ) ) {
element = cloneElement( element, props );
}
}
/**
* Filters the save result of a block during serialization.
*
* @param {WPElement} element Block save result.
* @param {WPBlockType} blockType Block type definition.
* @param {Object} attributes Block attributes.
*/
element = applyFilters( 'blocks.getSaveElement', element, blockType, attributes );
return (
{ element }
const index = this.dropZones.indexOf( dropZone );
const isDraggingOverDropZone = index === hoveredDropZoneIndex;
dropZone.setState( {
isDraggingOverDocument: isTypeSupportedByDropZone( dragEventType, dropZone ),
isDraggingOverElement: isDraggingOverDropZone,
position: isDraggingOverDropZone ? position : null,
type: isDraggingOverDropZone ? dragEventType : null,
} );
} );
const newState = {
isDraggingOverDocument: true,
hoveredDropZone: hoveredDropZoneIndex,
position,
};
if ( ! isShallowEqual( newState, this.state ) ) {
this.setState( newState );
}
}
shouldReplaceReviews( prevProps, nextProps ) {
return (
prevProps.orderby !== nextProps.orderby ||
prevProps.order !== nextProps.order ||
prevProps.productId !== nextProps.productId ||
! isShallowEqual( prevProps.categoryIds, nextProps.categoryIds )
);
}
shouldComponentUpdate( nextProps ) {
return ! isShallowEqual( nextProps, this.props );
}
updateNestedSettings() {
const {
blockListSettings,
allowedBlocks,
updateNestedSettings,
} = this.props;
const newSettings = {
allowedBlocks,
templateLock: this.getTemplateLock(),
};
if ( ! isShallowEqual( blockListSettings, newSettings ) ) {
updateNestedSettings( newSettings );
}
}
hasSameCurrency( other ) {
Money.assertMoney( other );
return isShallowEqual(
this.currency.toJSON(),
other.currency.toJSON()
);
}
.find( ( snapLine ) =>
isShallowEqual( item[ 0 ], snapLine[ 0 ] ) &&
isShallowEqual( item[ 1 ], snapLine[ 1 ] ),
);
updateNestedSettings() {
const {
blockListSettings,
allowedBlocks,
updateNestedSettings,
templateLock,
parentLock,
} = this.props;
const newSettings = {
allowedBlocks,
templateLock: templateLock === undefined ? parentLock : templateLock,
};
if ( ! isShallowEqual( blockListSettings, newSettings ) ) {
updateNestedSettings( newSettings );
}
}
const {
blockListSettings,
allowedBlocks,
updateNestedSettings,
templateLock,
parentLock,
__experimentalCaptureToolbars,
} = this.props;
const newSettings = {
allowedBlocks,
templateLock: templateLock === undefined ? parentLock : templateLock,
__experimentalCaptureToolbars: __experimentalCaptureToolbars || false,
};
if ( ! isShallowEqual( blockListSettings, newSettings ) ) {
updateNestedSettings( newSettings );
}
}