Skip to content

Commit 030a49f

Browse files
committed
fix: preserve issue navigator reference results
1 parent dfc6ba7 commit 030a49f

4 files changed

Lines changed: 52 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## 0.7.1 - Unreleased
44

5+
- Keep Issue Navigator reference clicks from being overwritten by clipboard seeding, and show unresolved GitHub metadata as the reference label instead of "preview unavailable."
6+
57
## 0.7.0 - 2026-05-31
68

79
- Add copyable update diagnostics in About so Sparkle install-location failures include bundle path, resolved path, signing, Homebrew, translocation, and quarantine signals. (#70)

Sources/RepoBar/Views/IssueNavigatorModels.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@ struct IssueNavigatorScope: Identifiable, Hashable {
5050
}
5151

5252
extension GitHubReferenceMatch {
53+
var issueNavigatorHeaderTitle: String {
54+
self.isResolved ? self.title : self.query.displayText
55+
}
56+
5357
var issueNavigatorTitle: String {
54-
switch self.query {
58+
guard self.isResolved else { return self.query.displayText }
59+
60+
return switch self.query {
5561
case let .issueNumber(number),
5662
let .repositoryNameIssueNumber(_, number),
5763
let .repositoryIssueNumber(_, number):

Sources/RepoBar/Views/IssueNavigatorView.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct IssueNavigatorView: View {
7272
self.browserStore.onNavigationStateChange = {
7373
self.browserNavigationVersion &+= 1
7474
}
75-
self.updateClipboard(seedIfEmpty: true)
75+
self.updateClipboard(seedIfEmpty: Self.shouldSeedClipboardOnAppear(hasInitialMatches: self.results.isEmpty == false))
7676
if self.results.isEmpty {
7777
self.scheduleSearch(immediate: true)
7878
} else {
@@ -315,7 +315,7 @@ struct IssueNavigatorView: View {
315315
.frame(width: 32, height: 32)
316316

317317
VStack(alignment: .leading, spacing: 2) {
318-
Text(match.title)
318+
Text(match.issueNavigatorHeaderTitle)
319319
.font(.system(size: 16, weight: .semibold))
320320
.lineLimit(1)
321321
HStack(spacing: 6) {
@@ -371,6 +371,10 @@ struct IssueNavigatorView: View {
371371
}
372372
}
373373

374+
nonisolated static func shouldSeedClipboardOnAppear(hasInitialMatches: Bool) -> Bool {
375+
!hasInitialMatches
376+
}
377+
374378
@MainActor
375379
private func performSearch(generation: UUID) async {
376380
guard self.isCurrentSearch(generation) else { return }
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import Foundation
2+
@testable import RepoBar
3+
@testable import RepoBarCore
4+
import Testing
5+
6+
struct IssueNavigatorViewTests {
7+
@Test
8+
func `initial reference matches do not get overwritten by clipboard seed`() {
9+
#expect(!IssueNavigatorView.shouldSeedClipboardOnAppear(hasInitialMatches: true))
10+
#expect(IssueNavigatorView.shouldSeedClipboardOnAppear(hasInitialMatches: false))
11+
}
12+
13+
@Test
14+
func `decorated issue navigator labels remain parseable for manual search`() {
15+
let queries = GitHubReferenceTranslator.queries(from: "1. openclaw/gogcli#673 · 1 PR · add --thread-id to G")
16+
17+
#expect(queries == [.repositoryIssueNumber(repositoryFullName: "openclaw/gogcli", number: 673)])
18+
}
19+
20+
@Test
21+
func `unresolved metadata uses reference label in navigator chrome`() throws {
22+
let match = try GitHubReferenceMatch(
23+
query: .repositoryIssueNumber(repositoryFullName: "openclaw/imsg", number: 135),
24+
title: "GitHub preview unavailable",
25+
url: #require(URL(string: "https://github.com/openclaw/imsg/issues/135")),
26+
repositoryFullName: "openclaw/imsg",
27+
kind: .issue,
28+
state: nil,
29+
createdAt: nil,
30+
updatedAt: Date(timeIntervalSince1970: 0),
31+
isResolved: false
32+
)
33+
34+
#expect(match.issueNavigatorHeaderTitle == "openclaw/imsg#135")
35+
#expect(match.issueNavigatorTitle == "openclaw/imsg#135")
36+
}
37+
}

0 commit comments

Comments
 (0)