diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 6cd06b8..e753ebc 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -75,16 +75,19 @@ router.beforeEach((to, _from, next) => { return } - // Auto-redirect: mobile devices hitting root → send to mobile home - // Allow manual override via ?view=desktop or ?view=mobile + // Auto-redirect on FIRST entry only (no previous route = fresh page load) + // Don't interfere with manual navigation (user clicked switch button) const viewOverride = to.query.view as string - if (!viewOverride) { + if (!viewOverride && !_from.name) { const onMobile = isMobile() - // Only redirect bare root — explicit paths are honored - if (onMobile && (to.path === '/' || to.path === '')) { + if (onMobile && to.path === '/') { next('/m') return } + if (!onMobile && to.path.startsWith('/m')) { + next('/') + return + } } next()