Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hmr issue due to disconnect #2169

Merged
merged 1 commit into from
Jul 5, 2023
Merged

fix: hmr issue due to disconnect #2169

merged 1 commit into from
Jul 5, 2023

Conversation

santhoshvai
Copy link
Member

@santhoshvai santhoshvai commented Jul 5, 2023

馃幆 Goal

During hot module reload, the app may throw the following error

 ERROR  Error: You can't use a channel after client.disconnect() was called

This error is located at:
    in ChannelPreviewMessengerWithContext (created by ChannelPreviewMessenger{channelPreview})
    in ChannelPreviewMessenger{channelPreview} (created by ChannelPreviewWithContext)
    in ChannelPreviewWithContext (created by ChannelPreview)

the HMR error was because the channel preview component rerendered during HMR of a global variable. This doesn't happen in our sample apps, but our awesome customer had made a repro at https://github.com/farmstrong8/stream-chat-rn-render

My theory is that due to some specific usage of react navigation the component rerenders.

But anyway we should not break HMRs.

After this fix, if the customer doesn't rerender the channel list after disconnect this error shouldn't happen. If customers render this error makes sense anyway.

馃洜 Implementation details

NA

馃帹 UI Changes

NA

鈽戯笍 Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@santhoshvai santhoshvai merged commit 9c8150f into develop Jul 5, 2023
7 of 8 checks passed
@santhoshvai santhoshvai deleted the fix/hmr-disconnect branch July 5, 2023 17:57
@github-actions github-actions bot mentioned this pull request Jul 5, 2023
@stream-ci-bot
Copy link
Contributor

馃帀 This PR is included in version 5.15.3 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

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.

None yet

2 participants