From 8e0c45f18ec45cdae5b7360d0fae7edbd4179fb1 Mon Sep 17 00:00:00 2001 From: Marcus Kida Date: Mon, 8 Jan 2024 11:01:36 +0100 Subject: [PATCH] Revert data propagation order in SearchResultViewModel --- .../SearchResult/SearchResultViewModel+State.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift index df6e0bb8b..63835ea1e 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift @@ -147,21 +147,21 @@ extension SearchResultViewModel.State { // reset data source when the search is refresh if offset == nil { - await viewModel.dataController.reset() viewModel.relationships = [] viewModel.accounts = [] + await viewModel.dataController.reset() viewModel.hashtags = [] } - - await viewModel.dataController.appendRecords(statuses) - + // due to combine relationships must be set first var existingRelationships = viewModel.relationships for hashtag in relationships where !existingRelationships.contains(hashtag) { existingRelationships.append(hashtag) } viewModel.relationships = existingRelationships + await viewModel.dataController.appendRecords(statuses) + var existingHashtags = viewModel.hashtags for hashtag in searchResults.hashtags where !existingHashtags.contains(hashtag) { existingHashtags.append(hashtag)