Merge remote-tracking branch 'origin/main' into terry-wallet-login

This commit is contained in:
TerryM
2026-06-02 12:08:45 +08:00
15 changed files with 271 additions and 107 deletions

View File

@@ -340,14 +340,16 @@ export function PublicLayout() {
// Current page name shown in the header brand slot (falls back to the brand).
const pageTitle = usePageTitle();
// Warm the common stream views (全部资料 / 热门资料 / 最新) in the background so
// tapping them shows content immediately. Run one at a time, spaced out and
// only while idle, so prefetching never competes with the current page or
// janks low-end phones. Prefetch is JSON-only (no images).
// Warm the common stream views (全部资料 / 热门资料 / 最新) so tapping them
// shows content immediately. The default "all" stream is the most common
// destination (banners, Home cards) and fires right on mount so a fast tap
// still hits a warm cache. Popular / latest stay deferred to idle time so
// they don't compete with the current page on low-end phones.
useEffect(() => {
const base = { scope: { kind: "all" as const }, type: "all", q: "", lang };
prefetchPostStream({ ...base, sort: "" });
const jobs = [
() => prefetchPostStream({ ...base, sort: "" }),
() => prefetchPostStream({ ...base, sort: "popular" }),
() => prefetchPostStream({ ...base, sort: "latest" }),
];
@@ -369,7 +371,7 @@ export function PublicLayout() {
else stepTimer = window.setTimeout(runNext, 200);
};
const startTimer = window.setTimeout(schedule, 600);
const startTimer = window.setTimeout(schedule, 300);
return () => {
window.clearTimeout(startTimer);
window.clearTimeout(stepTimer);