import flattenList from "./flattenList";
import equalItems from "./equalItems";

// 暂时不使用, 会导致children里的Loading以及错误信息等不更新
// Rerender if value or list changes
var memoRerender = function memoRerender(prevProps, nextProps) {
  // Equal value
  var prevValue = flattenList(prevProps.value);
  var nextValue = flattenList(nextProps.value);
  if (equalItems(prevValue, nextValue) === false) {
    return false;
  }

  // Equal list
  var prevItems = flattenList(prevProps.list);
  var nextItems = flattenList(nextProps.list);
  return equalItems(prevItems, nextItems);
};
export default memoRerender;