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 [loading, setLoad] = useState(true)
|
||||
const [hasData, setHasData]= useState(false)
|
||||
const [importHistoryKey, setImportHistoryKey] = useState(Date.now()) // BUG-004 fix
|
||||
|
||||
const load = async () => {
|
||||
setLoad(true)
|
||||
|
|
@ -784,8 +785,8 @@ export default function NutritionPage() {
|
|||
{/* Import Panel + History */}
|
||||
{inputTab==='import' && (
|
||||
<>
|
||||
<ImportPanel onImported={load}/>
|
||||
<ImportHistory/>
|
||||
<ImportPanel onImported={() => { load(); setImportHistoryKey(Date.now()) }}/>
|
||||
<ImportHistory key={importHistoryKey}/>
|
||||
</>
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user