Skip to content

Commit

Permalink
Do not watch channels when searching by channels (#3472)
Browse files Browse the repository at this point in the history
* Do not watch channels when searching by channels

* Update CHANGELOG.md
  • Loading branch information
nuno-vieira authored Oct 24, 2024
1 parent 3461b05 commit 55fe259
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# Upcoming

## StreamChat
### 🐞 Fixed
- Fix watching channels when performing channel search [#3472](https://github.com/GetStream/stream-chat-swift/pull/3472)

## StreamChatUI
### ✅ Added
- Open `shouldMarkThreadRead` and `shouldMarkChannelRead` [#3468](https://github.com/GetStream/stream-chat-swift/pull/3468)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ open class ChatChannelSearchVC: ChatChannelListSearchVC {
override open func loadSearchResults(with text: String) {
guard let currentUserId = controller.client.currentUserId else { return }

replaceQuery(.init(
var searchChannelsQuery = ChannelListQuery(
filter: .and([
.autocomplete(.name, text: text),
.containMembers(userIds: [currentUserId])
])
))
)
// Do not watch the query when searching.
searchChannelsQuery.options = []

replaceQuery(searchChannelsQuery)
}

override open func loadMoreSearchResults() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ final class ChatChannelSearchVC_Tests: XCTestCase {
vc.controller.query.filter.filterHash,
"(name AUTOCOMPLETE Dummy) AND (members IN [\"\(currentUserId)\"])"
)
XCTAssertTrue(vc.controller.query.options.isEmpty)
}

func test_loadMoreSearchResults() {
Expand Down

0 comments on commit 55fe259

Please sign in to comment.