Skip to content

Commit 4f71ec0

Browse files
authored
fix: back functionality in settings (#284)
1 parent 0c94aff commit 4f71ec0

1 file changed

Lines changed: 1 addition & 19 deletions

File tree

app/pages/settings.vue

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,8 @@ const availableLocales = computed(() =>
88
locales.value.map(l => (typeof l === 'string' ? { code: l, name: l } : l)),
99
)
1010
11-
/**
12-
* Check if it's safe to navigate back.
13-
* Uses the router's history state to verify there's a previous page in the SPA navigation history.
14-
*/
15-
function canGoBack(): boolean {
16-
if (import.meta.server) return false
17-
if (window.history.length <= 1) return false
18-
19-
// Check if we have a valid position in the history state
20-
// This works correctly with client-side SPA navigation (unlike document.referrer)
21-
const state = window.history.state as { position?: number } | null
22-
return state?.position != null && state.position > 0
23-
}
24-
2511
function goBack() {
26-
if (canGoBack()) {
27-
router.back()
28-
} else {
29-
router.push('/')
30-
}
12+
router.back()
3113
}
3214
3315
onKeyStroke('Escape', e => {

0 commit comments

Comments
 (0)