Skip to content

Commit 9e7575e

Browse files
authored
[CLNP-6588] Add deps in unmount (#1323)
[fix]: SendbirdProvider unmount not disconnects Fixes [CLNP-6588](https://sendbird.atlassian.net/browse/CLNP-6588) ### Changelogs - Fixed a bug that the connection does not disconnect on unmount ### Checklist Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If unsure, ask the members. This is a reminder of what we look for before merging your code. - [x] **All tests pass locally with my changes** - [ ] **I have added tests that prove my fix is effective or that my feature works** - [ ] **Public components / utils / props are appropriately exported** - [ ] I have added necessary documentation (if appropriate) ## External Contributions This project is not yet set up to accept pull requests from external contributors. If you have a pull request that you believe should be accepted, please contact the Developer Relations team <developer-advocates@sendbird.com> with details and we'll evaluate if we can set up a [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement) to allow for the contribution. [CLNP-6588]: https://sendbird.atlassian.net/browse/CLNP-6588?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 0cee27b commit 9e7575e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/lib/Sendbird/context/SendbirdProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const SendbirdContextManager = ({
125125
// Disconnect on unmount
126126
useUnmount(() => {
127127
actions.disconnect({ logger });
128-
});
128+
}, [sdkStore]);
129129

130130
// should move to reducer
131131
const [currentTheme, setCurrentTheme] = useState(theme);

src/lib/Sendbird/context/hooks/useSendbird.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export const useSendbird = () => {
225225
actions.resetUser();
226226
logger.info?.('SendbirdProvider | useSendbird/disconnect completed');
227227
},
228-
}), [store, state.stores.appInfoStore]);
228+
}), [store, state.stores.sdkStore?.sdk, state.stores.appInfoStore]);
229229

230230
return { state, actions };
231231
};

0 commit comments

Comments
 (0)