react-realtime-hooks 1.4.2 → 1.4.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.
package/dist/index.cjs CHANGED
@@ -942,8 +942,9 @@ var useWebSocket = (options) => {
942
942
  const nextSocketEpochRef = react.useRef(0);
943
943
  const controller = useWebSocketController();
944
944
  const [openNonce, setOpenNonce] = react.useState(0);
945
+ const initialStatus = !supported || resolvedUrl === null ? "closed" : connect ? "connecting" : "idle";
945
946
  const [state, setState] = react.useState(
946
- () => createInitialState4(connect ? "connecting" : "idle")
947
+ () => createInitialState4(initialStatus)
947
948
  );
948
949
  const stateRef = react.useRef(state);
949
950
  react.useInsertionEffect(() => {
@@ -1517,8 +1518,9 @@ var useEventSource = (options) => {
1517
1518
  const suppressReconnectRef = react.useRef(false);
1518
1519
  const terminalErrorRef = react.useRef(null);
1519
1520
  const [openNonce, setOpenNonce] = react.useState(0);
1521
+ const initialStatus = !supported || resolvedUrl === null ? "closed" : connect ? "connecting" : "idle";
1520
1522
  const [state, setState] = react.useState(
1521
- () => createInitialState5(connect ? "connecting" : "idle")
1523
+ () => createInitialState5(initialStatus)
1522
1524
  );
1523
1525
  const stateRef = react.useRef(state);
1524
1526
  react.useInsertionEffect(() => {