Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

feat: add useChannelStateListener and useConnectionStateListener hooks #65

Merged
merged 10 commits into from
Aug 10, 2023

Conversation

owenpearson
Copy link
Contributor

Supersedes #52

Resolves #54, #59

Jira links:

I've opted to remove the useChannelState and useConnectionState hooks for now since the functionality is already covered with the listener variants and it's relatively simple to make a component re-render when the state changes using useState. If there's demand for it we can always add the non-listener variants back in future.

@owenpearson owenpearson force-pushed the add-useConnectionState-and-useChannelState branch 2 times, most recently from f3554f2 to 595ce39 Compare August 9, 2023 18:41
src/AblyReactHooks.ts Outdated Show resolved Hide resolved
src/hooks/useEventListener.ts Outdated Show resolved Hide resolved
src/fakes/ably.ts Show resolved Hide resolved
src/hooks/useConnectionStateListener.test.tsx Outdated Show resolved Hide resolved
src/hooks/useChannelStateListener.ts Outdated Show resolved Hide resolved
src/hooks/useChannelStateListener.test.tsx Outdated Show resolved Hide resolved
@owenpearson owenpearson force-pushed the add-useConnectionState-and-useChannelState branch 2 times, most recently from 8f2ba2a to a84eb93 Compare August 10, 2023 10:11
@owenpearson owenpearson force-pushed the add-useConnectionState-and-useChannelState branch from a84eb93 to 0e3d0af Compare August 10, 2023 10:13
stmoreau and others added 8 commits August 10, 2023 11:51
this functionality is covered by the listener hooks and it's
straightforward enough to get the same behaviour by just updating a
`useState` inside the listener function so i'm removing these for now
just for simplicity.
gives the user full control over whether their component re-renders
@owenpearson owenpearson force-pushed the add-useConnectionState-and-useChannelState branch from 0e3d0af to 46f98d6 Compare August 10, 2023 10:57
@owenpearson owenpearson merged commit 33a441d into integration/v3 Aug 10, 2023
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants