Bug: Step5 去配音库上传按钮跳转错误,跳到概览页面而非配音库页面 #1266

Closed
opened 2026-08-07 18:29:22 +08:00 by xiaoxia · 0 comments
Owner

问题描述

智能剪辑 Step5(选择配音)页面中,当暂无配音素材时,显示"去配音库上传"按钮。点击该按钮后跳转到了概览页面(Dashboard),而不是配音库页面。

根因分析

apps/web/src/pages/generate/components/Step5VoiceSelect.tsx 第89行:

const handleGoToUpload = useCallback(() => {
  window.location.href = "/voices"
}, [])

两个问题:

  1. 使用了 window.location.href 而非 react-router 的 navigate(),导致页面完全刷新而非 SPA 导航
  2. 路径 /voices 缺少 /app 前缀,应该是 /app/voices

期望行为

点击"去配音库上传"按钮后,应使用 navigate("/app/voices") 跳转到配音库页面。

修复方案

import { useNavigate } from "react-router-dom"
const navigate = useNavigate()
const handleGoToUpload = useCallback(() => {
  navigate("/app/voices")
}, [navigate])
## 问题描述 智能剪辑 Step5(选择配音)页面中,当暂无配音素材时,显示"去配音库上传"按钮。点击该按钮后跳转到了概览页面(Dashboard),而不是配音库页面。 ## 根因分析 `apps/web/src/pages/generate/components/Step5VoiceSelect.tsx` 第89行: ```ts const handleGoToUpload = useCallback(() => { window.location.href = "/voices" }, []) ``` 两个问题: 1. 使用了 `window.location.href` 而非 react-router 的 `navigate()`,导致页面完全刷新而非 SPA 导航 2. 路径 `/voices` 缺少 `/app` 前缀,应该是 `/app/voices` ## 期望行为 点击"去配音库上传"按钮后,应使用 `navigate("/app/voices")` 跳转到配音库页面。 ## 修复方案 ```ts import { useNavigate } from "react-router-dom" const navigate = useNavigate() const handleGoToUpload = useCallback(() => { navigate("/app/voices") }, [navigate]) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: xiaoxia/xiaoxia-saas#1266