[#338] HomeView의 최근 수정 섹션 내용이 반영되지 않는 문제를 해결한다#339
Conversation
opficdev
commented
Mar 30, 2026
- closed HomeView의 최근 수정 섹션 내용이 반영되지 않는 문제를 해결한다 #338
There was a problem hiding this comment.
Code Review
This pull request removes custom Equatable implementations across several structs to rely on compiler-synthesized member-wise equality. A critical issue was identified where the existing custom hash(into:) methods were not updated to match the new equality logic, violating the Hashable protocol contract which requires equal objects to have identical hash values. The reviewer provided actionable feedback to update the hashing logic for PushNotificationItem, RecentTodoItem, TodayTodoItem, and WebPageItem to ensure consistency and prevent bugs in collections or SwiftUI view updates.
| func hash(into hasher: inout Hasher) { | ||
| hasher.combine(id) | ||
| } |
There was a problem hiding this comment.
== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 모든 프로퍼티를 비교하게 되는데, 현재 hash(into:) 구현은 id 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.
hash(into:)가 합성된 ==와 일관성을 갖도록 모든 프로퍼티를 해싱하도록 수정해야 합니다.
func hash(into hasher: inout Hasher) {
hasher.combine(id)
hasher.combine(title)
hasher.combine(body)
hasher.combine(receivedAt)
hasher.combine(isRead)
hasher.combine(todoId)
hasher.combine(todoCategory)
}| func hash(into hasher: inout Hasher) { | ||
| hasher.combine(id) | ||
| } |
There was a problem hiding this comment.
== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 모든 프로퍼티를 비교하게 되는데, 현재 hash(into:) 구현은 id 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.
hash(into:)가 합성된 ==와 일관성을 갖도록 모든 프로퍼티를 해싱하도록 수정해야 합니다.
func hash(into hasher: inout Hasher) {
hasher.combine(id)
hasher.combine(number)
hasher.combine(title)
hasher.combine(isPinned)
hasher.combine(updatedAt)
hasher.combine(tags)
hasher.combine(category)
}| func hash(into hasher: inout Hasher) { | ||
| hasher.combine(id) | ||
| } |
There was a problem hiding this comment.
== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 모든 프로퍼티를 비교하게 되는데, 현재 hash(into:) 구현은 id 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.
hash(into:)가 합성된 ==와 일관성을 갖도록 모든 프로퍼티를 해싱하도록 수정해야 합니다.
func hash(into hasher: inout Hasher) {
hasher.combine(id)
hasher.combine(number)
hasher.combine(title)
hasher.combine(tags)
hasher.combine(isPinned)
hasher.combine(updatedAt)
hasher.combine(dueDate)
hasher.combine(category)
}| func hash(into hasher: inout Hasher) { | ||
| hasher.combine(metadata.url) | ||
| } |
There was a problem hiding this comment.
== 연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise) ==를 합성하도록 변경하셨습니다. 이는 metadata 프로퍼티 전체를 비교하게 되는데, 현재 hash(into:) 구현은 metadata.url 만을 사용하고 있어 Hashable 프로토콜의 규칙(a == b 이면 a.hashValue == b.hashValue)을 위반합니다. 이로 인해 Set이나 Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.
hash(into:)가 합성된 ==와 일관성을 갖도록 metadata의 모든 프로퍼티를 해싱하도록 수정해야 합니다. 가장 좋은 방법은 WebPage 타입을 Hashable로 만드는 것이지만, 그것이 불가능하다면 아래와 같이 직접 프로퍼티를 해싱해야 합니다.
func hash(into hasher: inout Hasher) {
hasher.combine(metadata.title)
hasher.combine(metadata.url)
hasher.combine(metadata.displayURL)
hasher.combine(metadata.imageURL)
}