fix state issues with collectionviews

fix constant cpu usage when looking at a collectionview
This commit is contained in:
Nihaal Sharma committed 2026-07-03 22:04:58 +01:00
1 parent a1d231054e
commit 698c711ab7
3 files changed
+9 -2

No files matched your search

@@ -30,7 +30,7 @@ struct EmojiPackManager: View {
List(selection: $selection) {
ForEach($hoarder.emojiPacks, id: \.self) { $pack in
NavigationLink {
EmojiPackDetailView(hoarder: hoarder, pack: $pack, useSwiftUIGrid: useSwiftUIGrid)
// EmojiPackDetailView(hoarder: hoarder, pack: $pack, useSwiftUIGrid: useSwiftUIGrid)
EmojiPackDetailViewRepresentable(hoarder: hoarder, pack: pack)
} label: {
Text(pack.name)
@@ -73,7 +73,8 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
case jumboMoji
}
override func viewWillLayoutSubviews() {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.refreshUI(with: items)
}
@@ -26,6 +26,7 @@ class EmojiPackDetailViewController: UINavigationController {
super.init(rootViewController: collectionView)
let editButton = UIBarButtonItem(systemItem: .edit)
editButton.target = self
let downloadButton = UIBarButtonItem(
image: UIImage(systemName: "arrow.down"),
style: .plain,
@@ -68,4 +69,9 @@ class EmojiPackDetailViewController: UINavigationController {
super.setEditing(editing, animated: animated)
collectionView.setEditing(editing, animated: animated)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
NotificationCenter.default.post(name: EmojiHoarder.NotifCategory.emojiPack(pack.id).name, object: nil)
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.