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('/')
startTransition(() => {
if (pathname !== newPath) {
router.push(newPath)
} else {
router.refresh()
}
})
// 🔥 核心修复:延迟 router.push确保 cookie 写入完成再跳转
setTimeout(() => {
startTransition(() => {
if (pathname !== newPath) {
router.push(newPath)
} else {
router.refresh()
}
})
}, 0)
}
return (