index.js
16 lines
| 1 | import { isEqual } from 'lodash'; |
| 2 | |
| 3 | function compareAttributes( prevAttributes, nextAttributes ) { |
| 4 | return Object.keys( prevAttributes ).every( ( key ) => { |
| 5 | return isEqual( prevAttributes[ key ], nextAttributes[ key ] ); |
| 6 | } ); |
| 7 | } |
| 8 | |
| 9 | export default function shouldRebuildCSS( prevProps, nextProps ) { |
| 10 | return ( |
| 11 | prevProps.deviceType === nextProps.deviceType && |
| 12 | prevProps.clientId === nextProps.clientId && |
| 13 | compareAttributes( prevProps.attributes, nextProps.attributes ) |
| 14 | ); |
| 15 | } |
| 16 |