react-hook-form 7.19.4 → 7.19.5
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -116,23 +116,29 @@ const tearDown = (_subscription) => {
|
|
116
116
|
_subscription.current = undefined;
|
117
117
|
}
|
118
118
|
};
|
119
|
-
const updateSubscriptionProps = ({ _subscription,
|
120
|
-
if (
|
119
|
+
const updateSubscriptionProps = ({ _subscription, _props }) => {
|
120
|
+
if (_props.current.disabled) {
|
121
121
|
tearDown(_subscription);
|
122
122
|
}
|
123
123
|
else if (!_subscription.current) {
|
124
|
-
_subscription.current =
|
125
|
-
next:
|
124
|
+
_subscription.current = _props.current.subject.subscribe({
|
125
|
+
next: _props.current.callback,
|
126
126
|
});
|
127
127
|
}
|
128
128
|
};
|
129
129
|
function useSubscribe(props) {
|
130
130
|
const _subscription = React.useRef();
|
131
|
+
const _props = React.useRef(props);
|
132
|
+
_props.current = props;
|
131
133
|
updateSubscriptionProps({
|
132
134
|
_subscription,
|
133
|
-
|
135
|
+
_props,
|
134
136
|
});
|
135
137
|
React.useEffect(() => {
|
138
|
+
updateSubscriptionProps({
|
139
|
+
_subscription,
|
140
|
+
_props,
|
141
|
+
});
|
136
142
|
return () => tearDown(_subscription);
|
137
143
|
}, []);
|
138
144
|
}
|