fix: [BUG-004] import history refreshes after CSV import
Solution: Force remount ImportHistory via key prop - Added importHistoryKey state (timestamp) - Update key after import → triggers useEffect reload - ImportHistory now updates immediately after import Closes: BUG-004 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
770a49b5f3
commit
d1675dcc80
|
|
@ -743,6 +743,7 @@ export default function NutritionPage() {
|
||||||
const [profile, setProf] = useState(null)
|
const [profile, setProf] = useState(null)
|
||||||
const [loading, setLoad] = useState(true)
|
const [loading, setLoad] = useState(true)
|
||||||
const [hasData, setHasData]= useState(false)
|
const [hasData, setHasData]= useState(false)
|
||||||
|
const [importHistoryKey, setImportHistoryKey] = useState(Date.now()) // BUG-004 fix
|
||||||
|
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
setLoad(true)
|
setLoad(true)
|
||||||
|
|
@ -784,8 +785,8 @@ export default function NutritionPage() {
|
||||||
{/* Import Panel + History */}
|
{/* Import Panel + History */}
|
||||||
{inputTab==='import' && (
|
{inputTab==='import' && (
|
||||||
<>
|
<>
|
||||||
<ImportPanel onImported={load}/>
|
<ImportPanel onImported={() => { load(); setImportHistoryKey(Date.now()) }}/>
|
||||||
<ImportHistory/>
|
<ImportHistory key={importHistoryKey}/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user