fix delete button not spawning half the time

This commit is contained in:
Nihaal Sharma committed 2026-08-25 17:06:15 +05:30
1 parent e104b028dd
commit 70e077051e
1 file changed
+3 -5
@@ -133,7 +133,7 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "plain", for: indexPath) as! PlainEmojiCollectionViewCell cell = collectionView.dequeueReusableCell(withReuseIdentifier: "plain", for: indexPath) as! PlainEmojiCollectionViewCell
case .full, .plainWithLabel: case .full, .plainWithLabel:
cell = collectionView.dequeueReusableCell(withReuseIdentifier: "full", for: indexPath) as! EmojiCollectionViewCell cell = collectionView.dequeueReusableCell(withReuseIdentifier: "full", for: indexPath) as! EmojiCollectionViewCell
(cell as! EmojiCollectionViewCell).setEdit(to: isEditing) (cell as! EmojiCollectionViewCell).setEdit(to: parent?.isEditing ?? false)
(cell as! EmojiCollectionViewCell).onRemove = { (cell as! EmojiCollectionViewCell).onRemove = {
guard let index = self.items.firstIndex(of: $0) else { return } guard let index = self.items.firstIndex(of: $0) else { return }
self.items.remove(at: index) self.items.remove(at: index)
@@ -240,11 +240,9 @@ final class EmojiCollectionView: UICollectionViewController, UICollectionViewDel
menuChildrem.append(UIMenu(options: .displayInline, children: [copyName, copyImage, share])) menuChildrem.append(UIMenu(options: .displayInline, children: [copyName, copyImage, share]))
let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash")) { action in let delete = UIAction(title: "Delete", image: UIImage(systemName: "trash")) { action in
Task.detached {
await self.hoarder.delete(emoji: self.hoarder.trie.dict[emojiName])
}
self.items.remove(at: indexPath.row)
Task.detached { @MainActor in Task.detached { @MainActor in
await self.hoarder.delete(emoji: self.hoarder.trie.dict[emojiName])
self.items.remove(at: indexPath.row)
await self.applySnapshot(animated: true) await self.applySnapshot(animated: true)
} }
} }
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.