react-realtime-hooks 1.3.0 → 1.3.2
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 +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -446,7 +446,9 @@ var createReconnectAttempt = (attempt, trigger, options, lastDelayMs, config = {
|
|
|
446
446
|
};
|
|
447
447
|
var useStableCallback = (callback) => {
|
|
448
448
|
const callbackRef = react.useRef(callback);
|
|
449
|
-
|
|
449
|
+
react.useInsertionEffect(() => {
|
|
450
|
+
callbackRef.current = callback;
|
|
451
|
+
});
|
|
450
452
|
return react.useCallback((...args) => callbackRef.current(...args), []);
|
|
451
453
|
};
|
|
452
454
|
|
|
@@ -468,9 +470,7 @@ var useReconnect = (options = {}) => {
|
|
|
468
470
|
const commitState = (next) => {
|
|
469
471
|
const resolved = typeof next === "function" ? next(stateRef.current) : next;
|
|
470
472
|
stateRef.current = resolved;
|
|
471
|
-
|
|
472
|
-
setState(resolved);
|
|
473
|
-
});
|
|
473
|
+
setState(resolved);
|
|
474
474
|
};
|
|
475
475
|
const runAttempt = useStableCallback((attempt) => {
|
|
476
476
|
commitState({
|