-
Notifications
You must be signed in to change notification settings - Fork 0
[#338] HomeView의 최근 수정 섹션 내용이 반영되지 않는 문제를 해결한다 #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,10 +26,6 @@ struct RecentTodoItem: Identifiable, Hashable { | |
| self.category = todo.category | ||
| } | ||
|
|
||
| static func == (lhs: RecentTodoItem, rhs: RecentTodoItem) -> Bool { | ||
| lhs.id == rhs.id | ||
| } | ||
|
|
||
| func hash(into hasher: inout Hasher) { | ||
| hasher.combine(id) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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)
} |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,10 +28,6 @@ struct TodayTodoItem: Identifiable, Hashable { | |
| self.category = todo.category | ||
| } | ||
|
|
||
| static func == (lhs: TodayTodoItem, rhs: TodayTodoItem) -> Bool { | ||
| lhs.id == rhs.id | ||
| } | ||
|
|
||
| func hash(into hasher: inout Hasher) { | ||
| hasher.combine(id) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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)
} |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,14 +19,8 @@ struct WebPageItem: Identifiable, Hashable { | |
| var url: URL { metadata.url } | ||
| var displayURL: String { metadata.displayURL.absoluteString } | ||
| var imageURL: URL? { metadata.imageURL } | ||
| } | ||
|
|
||
| extension WebPageItem { | ||
| func hash(into hasher: inout Hasher) { | ||
| hasher.combine(metadata.url) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
func hash(into hasher: inout Hasher) {
hasher.combine(metadata.title)
hasher.combine(metadata.url)
hasher.combine(metadata.displayURL)
hasher.combine(metadata.imageURL)
} |
||
|
|
||
| static func == (lhs: WebPageItem, rhs: WebPageItem) -> Bool { | ||
| lhs.metadata.url == rhs.metadata.url | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
==연산자 구현을 제거하여 컴파일러가 멤버와이즈(member-wise)==를 합성하도록 변경하셨습니다. 이는 모든 프로퍼티를 비교하게 되는데, 현재hash(into:)구현은id만을 사용하고 있어Hashable프로토콜의 규칙(a == b이면a.hashValue == b.hashValue)을 위반합니다. 이로 인해Set이나Dictionary에서, 또는 SwiftUI 뷰 업데이트 시 예기치 않은 동작이 발생할 수 있습니다.hash(into:)가 합성된==와 일관성을 갖도록 모든 프로퍼티를 해싱하도록 수정해야 합니다.