From 139116a0d38743e4df8b1971602d56374d429aa2 Mon Sep 17 00:00:00 2001 From: hzm <934585316@qq.com> Date: Mon, 16 Mar 2026 12:32:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/MarketIndexAccordion.jsx | 3 +++ app/page.jsx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/components/MarketIndexAccordion.jsx b/app/components/MarketIndexAccordion.jsx index 4a4c989..2d744d7 100644 --- a/app/components/MarketIndexAccordion.jsx +++ b/app/components/MarketIndexAccordion.jsx @@ -207,6 +207,7 @@ export default function MarketIndexAccordion({ const [settingOpen, setSettingOpen] = useState(false); const [tickerIndex, setTickerIndex] = useState(0); const rootRef = useRef(null); + const hasInitializedSelectedCodes = useRef(false); useEffect(() => { const el = rootRef.current; @@ -257,6 +258,7 @@ export default function MarketIndexAccordion({ // 初始化选中指数(本地偏好 > 默认集合) useEffect(() => { if (!indices.length || typeof window === 'undefined') return; + if (hasInitializedSelectedCodes.current) return; try { const stored = window.localStorage.getItem('marketIndexSelected'); const availableCodes = new Set(indices.map((it) => it.code)); @@ -266,6 +268,7 @@ export default function MarketIndexAccordion({ const filtered = parsed.filter((c) => availableCodes.has(c)); if (filtered.length) { setSelectedCodes(filtered); + hasInitializedSelectedCodes.current = true; return; } } diff --git a/app/page.jsx b/app/page.jsx index d6dd061..d45a5e4 100644 --- a/app/page.jsx +++ b/app/page.jsx @@ -1624,7 +1624,9 @@ export default function HomePage() { if (key === 'funds') { const prevSig = getFundCodesSignature(prevValue); const nextSig = getFundCodesSignature(nextValue); - if (prevSig === nextSig) return; + if (prevSig === nextSig) { + return; + } } if (!skipSyncRef.current) { const now = nowInTz().toISOString();