mirror of
https://github.com/thegeneralist01/archivr
synced 2026-10-09 21:03:17 +02:00
fix: guard detailMatchesSelection against null detail/selectedEntry
When both detail and selectedEntry are null (initial render or mid-navigation while a detail fetch is in flight), detail?.summary?.entry_uid and selectedEntry?.entry_uid both evaluate to undefined, making the equality true and causing a crash on detail.latest_summary. Add selectedEntry?.entry_uid != null guard so the condition short-circuits false whenever there is no real selection.
This commit is contained in:
parent
79ac44834e
commit
9b2ecb8d7b
3 changed files with 4 additions and 3 deletions
File diff suppressed because one or more lines are too long
|
|
@ -6,7 +6,7 @@
|
||||||
<title>Archivr</title>
|
<title>Archivr</title>
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
||||||
<script type="module" crossorigin src="/assets/index-9VVEGfc7.js"></script>
|
<script type="module" crossorigin src="/assets/index-BxBKvOHp.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-1h0SqIvL.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-1h0SqIvL.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,8 @@ export default function ContextRail({ archiveId, selectedEntry, selectedUids, se
|
||||||
summaryPollAbortRef.current = null
|
summaryPollAbortRef.current = null
|
||||||
summaryGenerateAbortRef.current?.abort()
|
summaryGenerateAbortRef.current?.abort()
|
||||||
summaryGenerateAbortRef.current = null
|
summaryGenerateAbortRef.current = null
|
||||||
const detailMatchesSelection = detail?.summary?.entry_uid === selectedEntry?.entry_uid
|
const detailMatchesSelection = selectedEntry?.entry_uid != null &&
|
||||||
|
detail?.summary?.entry_uid === selectedEntry?.entry_uid
|
||||||
setSummary(detailMatchesSelection ? detail.latest_summary ?? null : null)
|
setSummary(detailMatchesSelection ? detail.latest_summary ?? null : null)
|
||||||
setSummaryAttempt(detailMatchesSelection ? detail.summary_attempt ?? null : null)
|
setSummaryAttempt(detailMatchesSelection ? detail.summary_attempt ?? null : null)
|
||||||
setSummaryError('')
|
setSummaryError('')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue