downshift 8.2.4-alpha.1 → 8.2.4-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1723,12 +1723,19 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1723
1723
  }, [propsRef]);
1724
1724
  var action = actionRef.current;
1725
1725
  React.useEffect(function () {
1726
- var stateChanged = prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1727
- if (action && stateChanged) {
1726
+ console.log('effect');
1727
+ var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1728
+ console.log('passed', prevStateRef.current, state);
1729
+ if (shouldCallOnChangeProps) {
1728
1730
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1729
1731
  }
1730
1732
  prevStateRef.current = state;
1731
- }, [state, props, action, isStateEqual]);
1733
+ }, [state, action, isStateEqual]);
1734
+ React.useEffect(function () {
1735
+ if (props) {
1736
+ prevStateRef.current = getState(prevStateRef.current, props);
1737
+ }
1738
+ }, [props]);
1732
1739
  return [state, dispatchWithProps];
1733
1740
  }
1734
1741
 
@@ -1710,12 +1710,19 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1710
1710
  }, [propsRef]);
1711
1711
  var action = actionRef.current;
1712
1712
  useEffect(function () {
1713
- var stateChanged = prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1714
- if (action && stateChanged) {
1713
+ console.log('effect');
1714
+ var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1715
+ console.log('passed', prevStateRef.current, state);
1716
+ if (shouldCallOnChangeProps) {
1715
1717
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1716
1718
  }
1717
1719
  prevStateRef.current = state;
1718
- }, [state, props, action, isStateEqual]);
1720
+ }, [state, action, isStateEqual]);
1721
+ useEffect(function () {
1722
+ if (props) {
1723
+ prevStateRef.current = getState(prevStateRef.current, props);
1724
+ }
1725
+ }, [props]);
1719
1726
  return [state, dispatchWithProps];
1720
1727
  }
1721
1728
 
@@ -1619,12 +1619,19 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1619
1619
  }, [propsRef]);
1620
1620
  var action = actionRef.current;
1621
1621
  React.useEffect(function () {
1622
- var stateChanged = prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1623
- if (action && stateChanged) {
1622
+ console.log('effect');
1623
+ var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1624
+ console.log('passed', prevStateRef.current, state);
1625
+ if (shouldCallOnChangeProps) {
1624
1626
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1625
1627
  }
1626
1628
  prevStateRef.current = state;
1627
- }, [state, props, action, isStateEqual]);
1629
+ }, [state, action, isStateEqual]);
1630
+ React.useEffect(function () {
1631
+ if (props) {
1632
+ prevStateRef.current = getState(prevStateRef.current, props);
1633
+ }
1634
+ }, [props]);
1628
1635
  return [state, dispatchWithProps];
1629
1636
  }
1630
1637
 
@@ -1718,12 +1718,19 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
1718
1718
  }, [propsRef]);
1719
1719
  var action = actionRef.current;
1720
1720
  React.useEffect(function () {
1721
- var stateChanged = prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1722
- if (action && stateChanged) {
1721
+ console.log('effect');
1722
+ var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
1723
+ console.log('passed', prevStateRef.current, state);
1724
+ if (shouldCallOnChangeProps) {
1723
1725
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
1724
1726
  }
1725
1727
  prevStateRef.current = state;
1726
- }, [state, props, action, isStateEqual]);
1728
+ }, [state, action, isStateEqual]);
1729
+ React.useEffect(function () {
1730
+ if (props) {
1731
+ prevStateRef.current = getState(prevStateRef.current, props);
1732
+ }
1733
+ }, [props]);
1727
1734
  return [state, dispatchWithProps];
1728
1735
  }
1729
1736
 
@@ -3076,12 +3076,19 @@
3076
3076
  }, [propsRef]);
3077
3077
  var action = actionRef.current;
3078
3078
  React.useEffect(function () {
3079
- var stateChanged = prevStateRef.current && !isStateEqual(prevStateRef.current, state);
3080
- if (action && stateChanged) {
3079
+ console.log('effect');
3080
+ var shouldCallOnChangeProps = action && prevStateRef.current && !isStateEqual(prevStateRef.current, state);
3081
+ console.log('passed', prevStateRef.current, state);
3082
+ if (shouldCallOnChangeProps) {
3081
3083
  callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
3082
3084
  }
3083
3085
  prevStateRef.current = state;
3084
- }, [state, props, action, isStateEqual]);
3086
+ }, [state, action, isStateEqual]);
3087
+ React.useEffect(function () {
3088
+ if (props) {
3089
+ prevStateRef.current = getState(prevStateRef.current, props);
3090
+ }
3091
+ }, [props]);
3085
3092
  return [state, dispatchWithProps];
3086
3093
  }
3087
3094