Skip to content

Commit 90c034b

Browse files
committed
Fix selection being lost from URL on load
1 parent fd33e64 commit 90c034b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

web/src/lib/components/diff/concise-diff-view.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export interface UnresolvedLineSelection {
6060
end: UnresolvedLineRef;
6161
}
6262

63-
export function writeLineRef(ref: LineRef): string {
63+
export function writeLineRef(ref: UnresolvedLineRef): string {
6464
const prefix = ref.new ? "R" : "L";
6565
return prefix + ref.no.toString();
6666
}

web/src/lib/diff-viewer.svelte.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,12 @@ export function selectionsSemanticallyEqual(a: Selection | undefined, b: Selecti
128128

129129
function makeUrlHashValue(selection: Selection): string {
130130
let hash = encodeURIComponent(selection.file.toFile);
131-
if (selection.lines) {
131+
const lines = selection.lines ?? selection.unresolvedLines;
132+
if (lines) {
132133
hash += ":";
133-
hash += writeLineRef(selection.lines.start);
134+
hash += writeLineRef(lines.start);
134135
hash += ":";
135-
hash += writeLineRef(selection.lines.end);
136+
hash += writeLineRef(lines.end);
136137
}
137138
return hash;
138139
}

0 commit comments

Comments
 (0)