Skip to content

Conversation

@nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Nov 13, 2025

🔗 Issue Links

Resolves https://linear.app/stream/issue/IOS-1245

🎯 Goal

Fix Throttler crash in ChatChannelViewModel.handleMessageAppear().

📝 Summary

  • Fix Throttler crash in ChatChannelViewModel.handleMessageAppear()
  • Remove unnecessary channel query call when leaving the channel view in a mid-page

🛠 Implementation

Problem:

The crash was caused by accessing the channel controller at the same time by the main thread and the Throttler's serial queue.

Solution:

We need to change the Throttler's queue to be the main thread as well, just like we are doing in UIKit.

🧪 Manual Testing Notes

N/A. Unit tests have been added to replicate the crash.

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Documentation has been updated in the docs-content repo

@nuno-vieira nuno-vieira requested a review from a team as a code owner November 13, 2025 17:31
}

// Then - Should not crash
XCTAssert(true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like no reason to add, if crashes, then the test will crash and fail.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I know that, but I think it makes it easier to read the test, it's just for the sake of it. But I can remove it if you want 👍

@Stream-SDK-Bot
Copy link
Collaborator

SDK Size

title develop branch diff status
StreamChatSwiftUI 9.63 MB 9.63 MB 0 KB 🟢

@sonarqubecloud
Copy link

@github-actions
Copy link

Public Interface

🚀 No changes affecting the public interface.

@Stream-SDK-Bot
Copy link
Collaborator

StreamChatSwiftUI XCSize

Object Diff (bytes)
ChatChannelViewModel.o -500
AudioSessionFeedbackGenerator.o -429

@nuno-vieira nuno-vieira enabled auto-merge (squash) November 13, 2025 18:29
@nuno-vieira nuno-vieira disabled auto-merge November 13, 2025 18:56
@nuno-vieira nuno-vieira merged commit 1e35bca into develop Nov 14, 2025
11 checks passed
@nuno-vieira nuno-vieira deleted the fix/crash-handleMessageAppear-caused-by-throttler branch November 14, 2025 11:23
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants