feat(sidebar): RelatedStocks defaults collapsed + readOpen garbage-value fallback
readOpen() (reviewer f9027f5 non-blocking note):
- Previously returned v === '1' which collapsed '0' AND any garbage
value (legacy markers, manual edits) into the same false branch,
contradicting the 'fallback to default' comment. Split into three
explicit cases: '1' → true, '0' → false, anything else →
defaultOpen. Behavior unchanged for the writeOpen-only path; only
garbage input is corrected.
RelatedStocks defaultOpen=false:
- Of the three collapsible sidebar panels (AlertsPanel,
InvestmentNote, RelatedStocks), RelatedStocks has the lowest
information density per row and the weakest direct tie to 'this
symbol' (it's other symbols in the same market). Starting collapsed
cuts initial mobile scroll height for first-time visitors; once the
user toggles, localStorage pins their preference.
This commit is contained in:
@@ -33,7 +33,15 @@ export function RelatedStocks({ code }: { code: string }) {
|
||||
const subtitle = data?.market ? `${data.market} · 거래량 기준` : undefined;
|
||||
|
||||
return (
|
||||
<Collapsible title="관련 종목" subtitle={subtitle} storageKey="related">
|
||||
// defaultOpen=false — 사이드바의 세 collapsible 중 정보 밀도가 가장 낮고 "이 종목 자체"
|
||||
// 와의 직접 연관도 약함(같은 시장의 다른 종목 리스트). 진입 즉시 접혀 있다가 사용자가
|
||||
// 필요할 때 펴는 게 자연스러움. 첫 토글 이후엔 localStorage 가 사용자 선호로 굳음.
|
||||
<Collapsible
|
||||
title="관련 종목"
|
||||
subtitle={subtitle}
|
||||
storageKey="related"
|
||||
defaultOpen={false}
|
||||
>
|
||||
{err && (
|
||||
<div className="text-xs text-zinc-500">관련 종목 로딩 실패: {err}</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user