[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: back functionality in settings (#284)

authored by

Jaydip Sanghani and committed by
GitHub
4f71ec08 0c94aff3

+1 -19
+1 -19
app/pages/settings.vue
··· 8 8 locales.value.map(l => (typeof l === 'string' ? { code: l, name: l } : l)), 9 9 ) 10 10 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 - 25 11 function goBack() { 26 - if (canGoBack()) { 27 - router.back() 28 - } else { 29 - router.push('/') 30 - } 12 + router.back() 31 13 } 32 14 33 15 onKeyStroke('Escape', e => {