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,6 +39,9 @@ export function LanguageSwitcher() {
const newPath = '/' + segments.join('/') const newPath = '/' + segments.join('/')
// 🔥 核心修复:延迟 router.push确保 cookie 写入完成再跳转
setTimeout(() => {
startTransition(() => { startTransition(() => {
if (pathname !== newPath) { if (pathname !== newPath) {
router.push(newPath) router.push(newPath)
@ -46,6 +49,9 @@ export function LanguageSwitcher() {
router.refresh() router.refresh()
} }
}) })
}, 0)
} }
return ( return (