diff --git a/.changeset/slimy-geckos-sniff.md b/.changeset/slimy-geckos-sniff.md new file mode 100644 index 0000000..43a2a52 --- /dev/null +++ b/.changeset/slimy-geckos-sniff.md @@ -0,0 +1,6 @@ +--- +"@tapsioss/react-client-socket-manager": minor +--- + +Fix typo in `shouldUseStub` property for the `SocketClientProvider`. + \ No newline at end of file diff --git a/packages/react/README.md b/packages/react/README.md index d0c70a9..42e03c4 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -18,6 +18,9 @@ connections using `socket.io-client`. It provides easy setup and management of socket connections with support for automatic reconnections, event handling, and visibility change management. +> [!NOTE] +> For detailed information about the core functionality and additional features, please refer to the [@tapsioss/client-socket-manager core package documentation](https://github.com/Tap30/client-socket-manager/blob/main/packages/core/README.md). + ## Installation First, install the necessary dependencies: diff --git a/packages/react/src/SocketClientProvider.tsx b/packages/react/src/SocketClientProvider.tsx index 7ff6d06..cd8b76e 100644 --- a/packages/react/src/SocketClientProvider.tsx +++ b/packages/react/src/SocketClientProvider.tsx @@ -26,7 +26,7 @@ const __SINGLETON_REFS__: Record< * Properties: * - `children` (`React.ReactNode`): React children to render within the provider. * - `uri` (`string`): The URI to connect the socket client to. - * - `shouldUseStob?` (`boolean`): Optional flag indicating whether to use the stubbed version of `ClientSocketManager` (useful for SSR or testing). + * - `shouldUseStub?` (`boolean`): Optional flag indicating whether to use the stubbed version of `ClientSocketManager` (useful for SSR or testing). * - Additional props from `ClientSocketManagerOptions` can be provided, such as `eventHandlers`, `reconnectionDelay`, etc. * * @param props - Props for the provider, including connection URI, stub flag, and socket manager options. @@ -34,7 +34,7 @@ const __SINGLETON_REFS__: Record< * * @example * ```tsx - * + * * * * ``` @@ -58,7 +58,7 @@ const SocketClientProvider = (props: SocketClientProviderProps) => { React.useEffect(() => { if (!__SINGLETON_REFS__[uri]) { - if (props.shouldUseStob) { + if (props.shouldUseStub) { registerClientSocketManager(new ClientSocketManagerStub(uri, {})); } else { const client = new ClientSocketManagerOriginal(uri, { diff --git a/packages/react/src/types.ts b/packages/react/src/types.ts index ba67266..9ede91d 100644 --- a/packages/react/src/types.ts +++ b/packages/react/src/types.ts @@ -53,5 +53,5 @@ export type SocketClientProviderProps = { * Optional flag indicating whether to use the stubbed version of * ClientSocketManager. This is useful for SSR or tests. */ - shouldUseStob?: boolean; + shouldUseStub?: boolean; } & Partial;