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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIS-1288] Fix Message List NSInternalInconsistencyException Crash #1752

Merged

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Jan 10, 2022

🔗 Issue Link

CIS-1288

🎯 Goal

Fix a crash that happened when switching channels very quickly, and when the messages were not prefetched from a channel list.

🛠 Implementation

Call reloadData() when the data source of the message list is changed. When switching channels in quick succession it could happen that there were conflicts in the message list with the old data in case the ChatChannelVC was reused.

🎨 Changes

N/A

🧪 Testing

Steps to reproduce this:

  1. Apply this patch: dontSaveChannelListMessages.patch.zip
  2. Open the demo app with an iPad (Easier to quickly switch channels)
  3. Quickly switch channels
  4. Observe there are no crashes.

In order to reproduce the crash, make sure to revert this PR and delete the reloadData() from here: DemoAppCoordinatior.swift#L167 (This is why it was really hard to reproduce this issue because we were fixing it on the demo app).

☑️ Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero ⚠️ policy (required)
  • Changelog is updated with client-facing changes

@nuno-vieira nuno-vieira added 🐞 Bug An issue or PR related to a bug ❗️ High Priority An issue or PR that is marked as a high priority labels Jan 10, 2022
@nuno-vieira nuno-vieira requested a review from a team January 10, 2022 18:11
@nuno-vieira nuno-vieira changed the title [CIS-1288] Fix message list NSInternalInconsistencyException crash [CIS-1288] Fix Message List NSInternalInconsistencyException crash Jan 10, 2022
@nuno-vieira nuno-vieira changed the title [CIS-1288] Fix Message List NSInternalInconsistencyException crash [CIS-1288] Fix Message List NSInternalInconsistencyException Crash Jan 10, 2022
@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #1752 (d854f9d) into develop (6672eb8) will decrease coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1752      +/-   ##
===========================================
- Coverage    85.45%   85.36%   -0.09%     
===========================================
  Files          234      234              
  Lines        11247    11247              
===========================================
- Hits          9611     9601      -10     
- Misses        1636     1646      +10     
Flag Coverage Δ
llc-tests 85.36% <ø> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/StreamChat/Utils/Logger/Logger.swift 56.28% <0.00%> (-5.99%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6672eb8...d854f9d. Read the comment docs.

Copy link
Contributor

@bielikb bielikb left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@nuno-vieira nuno-vieira merged commit 37fe552 into develop Jan 11, 2022
@nuno-vieira nuno-vieira deleted the fix/CIS-1288-Crash-data-inconsistency-on-message-list branch January 11, 2022 10:56
@polqf polqf mentioned this pull request Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug ❗️ High Priority An issue or PR that is marked as a high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants