mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 09:50:16 +00:00
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:
1 parent
8d6c29e1ba
commit
873c9398fe
1 file changed
+7
-2
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user