react-realtime-hooks 1.2.2 → 1.3.1

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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Demo](https://img.shields.io/github/actions/workflow/status/volkov85/react-realtime-hooks/pages.yml?branch=main&label=demo)](https://github.com/volkov85/react-realtime-hooks/actions/workflows/pages.yml)
6
6
  [![license](https://img.shields.io/npm/l/react-realtime-hooks)](https://github.com/volkov85/react-realtime-hooks/blob/main/LICENSE)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-typed-3178c6)](https://www.typescriptlang.org/)
8
- [![react](https://img.shields.io/badge/react-19.2%2B-149eca)](https://www.npmjs.com/package/react)
8
+ [![react](https://img.shields.io/badge/react-18%20%7C%2019-149eca)](https://www.npmjs.com/package/react)
9
9
 
10
10
  Production-ready React hooks for WebSocket and SSE with auto-reconnect, heartbeat, typed connection state, and browser network awareness including page visibility and connection gating.
11
11
 
@@ -62,7 +62,7 @@ npm install react-realtime-hooks
62
62
 
63
63
  Peer dependency:
64
64
 
65
- - `react@^19.2.0`
65
+ - `react@>=18.0.0 <20.0.0` (tested against React 18.3, 19.0, and 19.2)
66
66
 
67
67
  ## How It Feels
68
68
 
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
- callbackRef.current = callback;
449
+ react.useInsertionEffect(() => {
450
+ callbackRef.current = callback;
451
+ });
450
452
  return react.useCallback((...args) => callbackRef.current(...args), []);
451
453
  };
452
454