Spaces:
Sleeping
Sleeping
ForStream Claude Opus 4.8 commited on
Commit ·
108b34c
1
Parent(s): ec47b7f
데이터관리 입력 탭 전환 시 소실 수정: userRecords를 App으로 lift
Browse filesDataTab 등록 검토건(userRecords)이 컴포넌트 로컬 state라 탭 전환 시
unmount되며 소실됐음. App으로 state를 올려 세션 동안 유지(탭 왕복 OK,
새로고침 시 리셋 — 세션 한정).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- web/src/App.jsx +3 -1
- web/src/DataTab.jsx +2 -2
web/src/App.jsx
CHANGED
|
@@ -11,6 +11,8 @@ const TABS = [
|
|
| 11 |
|
| 12 |
export default function App() {
|
| 13 |
const [tab, setTab] = useState('test');
|
|
|
|
|
|
|
| 14 |
|
| 15 |
return (
|
| 16 |
<div className="shell">
|
|
@@ -48,7 +50,7 @@ export default function App() {
|
|
| 48 |
<div className="wrap">
|
| 49 |
{tab === 'explain' && <ExplainTab />}
|
| 50 |
{tab === 'test' && <TestTab />}
|
| 51 |
-
{tab === 'data' && <DataTab />}
|
| 52 |
</div>
|
| 53 |
</main>
|
| 54 |
</div>
|
|
|
|
| 11 |
|
| 12 |
export default function App() {
|
| 13 |
const [tab, setTab] = useState('test');
|
| 14 |
+
// 등록 검토건은 App에 보관 → 탭 전환(DataTab unmount)에도 세션 동안 유지
|
| 15 |
+
const [userRecords, setUserRecords] = useState([]);
|
| 16 |
|
| 17 |
return (
|
| 18 |
<div className="shell">
|
|
|
|
| 50 |
<div className="wrap">
|
| 51 |
{tab === 'explain' && <ExplainTab />}
|
| 52 |
{tab === 'test' && <TestTab />}
|
| 53 |
+
{tab === 'data' && <DataTab userRecords={userRecords} setUserRecords={setUserRecords} />}
|
| 54 |
</div>
|
| 55 |
</main>
|
| 56 |
</div>
|
web/src/DataTab.jsx
CHANGED
|
@@ -5,9 +5,9 @@ const STAGE_OPTIONS = ['거래상대방 등록', '투자상담', '사전협의',
|
|
| 5 |
const STATUS_OPTIONS = ['진행중', '정체', '완료', '약정 진행 중', '약정체결 완료'];
|
| 6 |
const SEC_OPTIONS = ['보통주', 'CPS', 'RCPS', 'CB', 'BW', '기타'];
|
| 7 |
|
| 8 |
-
export default function DataTab() {
|
| 9 |
const [dataset, setDataset] = useState({ funds: [], gps: [] });
|
| 10 |
-
|
| 11 |
|
| 12 |
// 폼 상태
|
| 13 |
const [label, setLabel] = useState('');
|
|
|
|
| 5 |
const STATUS_OPTIONS = ['진행중', '정체', '완료', '약정 진행 중', '약정체결 완료'];
|
| 6 |
const SEC_OPTIONS = ['보통주', 'CPS', 'RCPS', 'CB', 'BW', '기타'];
|
| 7 |
|
| 8 |
+
export default function DataTab({ userRecords, setUserRecords }) {
|
| 9 |
const [dataset, setDataset] = useState({ funds: [], gps: [] });
|
| 10 |
+
// userRecords는 App에서 props로 받음 → 탭 전환에도 유지(세션 한정)
|
| 11 |
|
| 12 |
// 폼 상태
|
| 13 |
const [label, setLabel] = useState('');
|