export default function handlePopupResize(popupSize, onSetSizeRef, size) {
  const {
    height,
    width
  } = popupSize;
  const {
    height: oldHeight = 0,
    width: oldWidth = 0
  } = size.current || {};

  if (isPopupReady && size.current && (oldHeight !== height || width !== oldWidth)) {
    handlePopupPosition(position, true);
  }

  onSetSizeRef(popupSize);
}