fix: eliminate home page flash by using cached content on initial render

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 00:25:37 +08:00
parent 3fb6912bf5
commit 84e828d804

View File

@@ -82,8 +82,9 @@ const Home = () => {
const { i18n } = useTranslation();
const [statusState] = useContext(StatusContext);
const actualTheme = useActualTheme();
const [homePageContentLoaded, setHomePageContentLoaded] = useState(false);
const [homePageContent, setHomePageContent] = useState('');
const cachedContent = localStorage.getItem('home_page_content') || '';
const [homePageContentLoaded, setHomePageContentLoaded] = useState(!!cachedContent);
const [homePageContent, setHomePageContent] = useState(cachedContent);
const [noticeVisible, setNoticeVisible] = useState(false);
const isMobile = useIsMobile();