Skip to content

[CLNP-7306]Fixed a bug that caused a runtime exception when leaving or deleting a channel #1355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025

Conversation

danney-chun
Copy link
Contributor

@danney-chun danney-chun commented Jul 15, 2025

[fix]: Fixed a bug that caused a runtime exception when leaving or deleting a channel

Fixes CLNP-7306

Changelogs

  • Fixed a bug that caused a runtime exception when leaving or deleting a channel

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.

  • 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 [email protected] with details
and we'll evaluate if we can set up a CLA to allow for the contribution.

Copy link

netlify bot commented Jul 15, 2025

Deploy Preview for sendbird-uikit-react ready!

Name Link
🔨 Latest commit f872757
🔍 Latest deploy log https://app.netlify.com/projects/sendbird-uikit-react/deploys/6875c1391285d80008e07fc3
😎 Deploy Preview https://deploy-preview-1355--sendbird-uikit-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@danney-chun danney-chun self-assigned this Jul 15, 2025
@danney-chun danney-chun requested review from chrisallo, bang9, OnestarLee and Copilot and removed request for chrisallo, bang9 and OnestarLee July 15, 2025 02:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a runtime exception when leaving or deleting a channel by adding guards around channel state operations and updating handler logic.

  • Added a guard to skip marking as read if the member state is 'none', preventing invalid operations.
  • Updated setCurrentChannel to accept null and reset nickname mappings accordingly.
  • Ensured loading state is set before fetching a channel and prevented UI updates for the current user in channel event handlers.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/modules/GroupChannel/context/hooks/useGroupChannel.ts Guarded markAsReadScheduler and made setCurrentChannel accept null
src/modules/ChannelSettings/context/hooks/useSetChannel.ts Added setLoading(true) before async fetch
src/modules/ChannelSettings/context/hooks/useChannelHandler.ts Skipped forceUpdateUI when the event’s user is the current user
Comments suppressed due to low confidence (1)

src/modules/GroupChannel/context/hooks/useGroupChannel.ts:80

  • Consider adding unit tests to verify that the new guard correctly prevents markAsReadScheduler.push when myMemberState is 'none' and still marks read otherwise.
      if (!state.disableMarkAsRead && state.currentChannel.myMemberState !== 'none') {

Copy link
Collaborator

@chrisallo chrisallo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@danney-chun danney-chun merged commit 642d8a4 into main Jul 22, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants