fix: show cached forum name immediately on reload (no server wait)

- forumNameLoaded initializes true when localStorage has a cached name,
  so 2nd+ visits show the name right away instead of waiting for the
  settings fetch
- layout.js inline script writes cached name to <title> on first paint
  (first request HTML now carries the name)
This commit is contained in:
lezi-fun committed 2026-08-11 10:02:03 +08:00
1 parent c55fce445c
commit fe71b03d2e
2 files changed
+13 -1

No files matched your search

+5
View File
@@ -24,6 +24,11 @@ export default function RootLayout({ children }) {
}
document.documentElement.setAttribute('data-theme', t);
} catch (e) {}
// 论坛名:有缓存立即写入 <title>(第二次访问首帧即显示),无缓存保持 Loading...
try {
var n = localStorage.getItem('forumlify-forum-name');
if (n) document.title = n;
} catch (e) {}
})();`,
}}
/>