fix: loading title double-render + spinner restart (hydration)

Inline script fills cached name into #loadingTitle before React
hydrate; React then saw text mismatch and rewrote the DOM, making the
name appear twice and restarting the spinner animation. Add
suppressHydrationWarning so React keeps the script-filled content.
This commit is contained in:
lezi-fun committed 2026-08-11 10:25:33 +08:00
1 parent 1dbcb89fbd
commit c4ec3340de
1 file changed
+3 -1
+3 -1
View File
@@ -9,7 +9,9 @@ export default function LoadingScreen({ forumName, forumNameLoaded }) {
<div className="loading-screen">
<div className="loading-inner">
<div className="loading-spinner" />
<div className="loading-title loading-title-appear" id="loadingTitle">
{/* suppressHydrationWarning: 内联脚本会在 hydrate 前填入缓存名,
避免 React 检测到文本不匹配而重写 DOM(名字二次出现/转圈重启) */}
<div className="loading-title loading-title-appear" id="loadingTitle" suppressHydrationWarning>
{forumNameLoaded && forumName}
</div>
<div className="loading-sub">加载中...</div>