Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/slimy-geckos-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tapsioss/react-client-socket-manager": minor
---

Fix typo in `shouldUseStub` property for the `SocketClientProvider`.

3 changes: 3 additions & 0 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/SocketClientProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ 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.
* @returns A context provider that supplies the socket instance and its connection status.
*
* @example
* ```tsx
* <SocketClientProvider uri="https://example.com/socket" shouldUseStob={typeof window === "undefined"}>
* <SocketClientProvider uri="https://example.com/socket" shouldUseStub={typeof window === "undefined"}>
* <App />
* </SocketClientProvider>
* ```
Expand All @@ -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, {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ClientSocketManagerOptions>;