This commit is contained in:
hailin 2025-04-17 13:34:05 +08:00
parent a6eb3006a1
commit 8653187a04
1 changed files with 13 additions and 7 deletions

View File

@ -39,13 +39,19 @@ export function LanguageSwitcher() {
const newPath = '/' + segments.join('/') const newPath = '/' + segments.join('/')
startTransition(() => {
if (pathname !== newPath) { // 🔥 核心修复:延迟 router.push确保 cookie 写入完成再跳转
router.push(newPath) setTimeout(() => {
} else { startTransition(() => {
router.refresh() if (pathname !== newPath) {
} router.push(newPath)
}) } else {
router.refresh()
}
})
}, 0)
} }
return ( return (