fix(play): resolve hydration mismatch and fragile pace index
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -1261,6 +1261,7 @@ export default function HomePage() {
|
|||||||
|
|
||||||
const styleRow = OPTS.findIndex((o) => o.modal);
|
const styleRow = OPTS.findIndex((o) => o.modal);
|
||||||
const voiceRow = OPTS.findIndex((o) => o.label === "语音配音");
|
const voiceRow = OPTS.findIndex((o) => o.label === "语音配音");
|
||||||
|
const paceRow = OPTS.findIndex((o) => o.label === "内容节奏");
|
||||||
const genderIndex = sel[0] ?? 0;
|
const genderIndex = sel[0] ?? 0;
|
||||||
const gender = (OPTS[0]!.items[genderIndex] as Gender) ?? "男性向";
|
const gender = (OPTS[0]!.items[genderIndex] as Gender) ?? "男性向";
|
||||||
const phrases = EXAMPLE_PHRASES[gender];
|
const phrases = EXAMPLE_PHRASES[gender];
|
||||||
@@ -1335,7 +1336,7 @@ export default function HomePage() {
|
|||||||
const plotStyle = PLOT_STYLES[sel[2] ?? 1] ?? "多线转折";
|
const plotStyle = PLOT_STYLES[sel[2] ?? 1] ?? "多线转折";
|
||||||
const voice = OPTS[voiceRow]!.items[sel[voiceRow] ?? 1]!;
|
const voice = OPTS[voiceRow]!.items[sel[voiceRow] ?? 1]!;
|
||||||
const audioEnabled = voice === "开启";
|
const audioEnabled = voice === "开启";
|
||||||
const pace = PACINGS[sel[4] ?? 1] ?? "紧凑爽快";
|
const pace = PACINGS[sel[paceRow] ?? 1] ?? "紧凑爽快";
|
||||||
|
|
||||||
// worldSetting 顺序很重要:玩家输入若存在,必须放在最前面、单独成段、
|
// worldSetting 顺序很重要:玩家输入若存在,必须放在最前面、单独成段、
|
||||||
// 用强指令包住,否则模型会把它当成夹在风格说明里的背景参考、扩写出
|
// 用强指令包住,否则模型会把它当成夹在风格说明里的背景参考、扩写出
|
||||||
|
|||||||
+4
-4
@@ -580,10 +580,7 @@ function PlayInner() {
|
|||||||
// Once the player dismisses the silence nudge, keep it gone for this session.
|
// Once the player dismisses the silence nudge, keep it gone for this session.
|
||||||
const [nudgeDismissed, setNudgeDismissed] = useState(false);
|
const [nudgeDismissed, setNudgeDismissed] = useState(false);
|
||||||
const [settingsOpen, setSettingsOpen] = useState(false);
|
const [settingsOpen, setSettingsOpen] = useState(false);
|
||||||
const [visionClickEnabled, setVisionClickEnabled] = useState<boolean>(() => {
|
const [visionClickEnabled, setVisionClickEnabled] = useState(true);
|
||||||
if (typeof window === "undefined") return true;
|
|
||||||
return readStoredVisionClick();
|
|
||||||
});
|
|
||||||
|
|
||||||
const startedRef = useRef(false);
|
const startedRef = useRef(false);
|
||||||
const poolRef = useRef<Map<string, PrefetchEntry>>(new Map());
|
const poolRef = useRef<Map<string, PrefetchEntry>>(new Map());
|
||||||
@@ -653,6 +650,9 @@ function PlayInner() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
mutedRef.current = muted;
|
mutedRef.current = muted;
|
||||||
}, [muted]);
|
}, [muted]);
|
||||||
|
useEffect(() => {
|
||||||
|
setVisionClickEnabled(readStoredVisionClick());
|
||||||
|
}, []);
|
||||||
|
|
||||||
// Coarse liveness ping for active-time analytics. /play is a single SPA
|
// Coarse liveness ping for active-time analytics. /play is a single SPA
|
||||||
// route, so page views alone read as ~0 duration; a 30s heartbeat (only
|
// route, so page views alone read as ~0 duration; a 30s heartbeat (only
|
||||||
|
|||||||
Reference in New Issue
Block a user