Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 85631a4

Browse files
committed
fix: map repository labels correctly
1 parent 52a61a9 commit 85631a4

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Classes/Labels/GitHubClient+RepositoryLabels.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ private extension FetchRepositoryLabelsQuery.Data {
1616
repository?.labels.map { nodes in
1717
nodes.nodes.map { node in
1818
labels += node.compactMap {
19-
$0?.node?.name,
20-
$0?.node?.color
19+
guard let label = $0 else { return nil }
20+
return RepositoryLabel(color: label.color, name: label.name)
2121
}
2222
}
2323
}

Classes/Labels/LabelsViewController.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,7 @@ LabelSectionControllerDelegate {
9797
guard let strongSelf = self else { return }
9898
switch result {
9999
case .success(let payload):
100-
self?.labels = payload.labels.compactMap {
101-
guard let node = $0 else { return nil }
102-
return RepositoryLabel(color: node.color, name: node.name)
103-
}.sorted { $0.name < $1.name }
100+
self?.labels = payload.labels.sorted { $0.name < $1.name }
104101
strongSelf.update(animated: true)
105102
case .error(let error):
106103
Squawk.show(error: error)

0 commit comments

Comments
 (0)