Skip to content

Commit

Permalink
Fix search home page refresh bug (#706)
Browse files Browse the repository at this point in the history
(cherry picked from commit 646ee5a)
  • Loading branch information
Sjmarf authored and boscojwho committed Nov 23, 2023
1 parent eae5376 commit d596d0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Mlem/Views/Tabs/Search/SearchHomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ struct SearchHomeView: View {
searchModel.tabSwitchRefresh(contentTracker: contentTracker)
}
.onAppear {
contentTracker.refresh(using: searchModel.performSearch)
if contentTracker.items.isEmpty {
contentTracker.refresh(using: searchModel.performSearch)
}
}
}
}
2 changes: 1 addition & 1 deletion Mlem/Views/Tabs/Search/SearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ struct SearchView: View {
.transition(.opacity)
case .results:
SearchResultsView()
.environmentObject(searchModel)
.transition(.opacity)
}
}
Expand All @@ -105,7 +106,6 @@ struct SearchView: View {
}
}
.fancyTabScrollCompatible()
.environmentObject(searchModel)
.scrollDismissesKeyboard(.immediately)
}
}

0 comments on commit d596d0b

Please sign in to comment.