This commit is contained in:
parent
a6eb3006a1
commit
8653187a04
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Reference in New Issue