Fix overlapping and misplaced sidebar rows when toggling Hide Read Feeds — use stable content-based identity for diffable items instead of recyclable Node object identity.

This commit is contained in:
Brent Simmons committed 2026-08-11 20:00:07 -07:00
1 parent 8d6c29e1ba
commit 873c9398fe
1 file changed
+7 -2
+7 -2
View File
@@ -31,18 +31,23 @@ enum ShowFeedName {
struct SidebarItemNode: Hashable, Sendable {
let node: Node
let sidebarItemID: SidebarItemIdentifier
// The parent scoping keeps identifiers distinct when the same feed
// appears in more than one folder.
let parentContainerID: ContainerIdentifier?
@MainActor init(_ node: Node) {
self.node = node
self.sidebarItemID = (node.representedObject as! SidebarItem).sidebarItemID!
self.parentContainerID = (node.parent?.representedObject as? ContainerIdentifiable)?.containerID
}
nonisolated func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(node))
hasher.combine(sidebarItemID)
hasher.combine(parentContainerID)
}
nonisolated static func == (lhs: SidebarItemNode, rhs: SidebarItemNode) -> Bool {
lhs.node === rhs.node
lhs.sidebarItemID == rhs.sidebarItemID && lhs.parentContainerID == rhs.parentContainerID
}
}