Skip to content

Commit 940b9df

Browse files
committed
Improve history handling
1 parent 695b6dd commit 940b9df

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/routes/+page.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,13 @@
200200
}
201201
try {
202202
const parsed = parseRepoUrl(repo)
203+
const targetPath = `${resolve('/')}${parsed.host}/${parsed.owner}/${parsed.repo}`
204+
// Push a new history entry when navigating to a different repo,
205+
// but replace when confirming the current URL (initial load, back button)
206+
const isSamePath = page.url.pathname === targetPath
203207
// eslint-disable-next-line svelte/no-navigation-without-resolve -- resolve('/') is embedded in template
204-
goto(`${resolve('/')}${parsed.host}/${parsed.owner}/${parsed.repo}`, {
205-
replaceState: true,
208+
goto(targetPath, {
209+
replaceState: isSamePath,
206210
keepFocus: true,
207211
})
208212
} catch {

0 commit comments

Comments
 (0)