Skip to content

Commit 7e9e1d9

Browse files
kruscheclaude
andcommitted
Address final review nits: log fetch errors and guard scheduledAt match
Two small polish items from the regression-risk review: - ImprintPage / PrivacyPage: the prior .catch silently swallowed every rejection. Now we ignore AbortError (intentional unmount cleanup) and log other failures via console.warn so dev/operators still see real network or sanitization problems. - ReplacePresentationModal: when picking the newly-created presentation from the response, the previous logic fell back to comparing p.scheduledAt === null when the form's date was missing — which would spuriously match an unrelated record with a null scheduledAt. The form already validates date as required so this was practically unreachable, but the new code guards explicitly: no match when no date was submitted. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f6b6313 commit 7e9e1d9

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

client/src/components/PresentationsTable/components/ReplacePresentationModal/ReplacePresentationModal.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,18 @@ const ReplacePresentationModal = (props: IReplacePresentationModalProps) => {
126126
onClose()
127127

128128
// Find the updated or newly created presentation
129+
const targetScheduledAt =
130+
form.values.date instanceof Date
131+
? form.values.date.toISOString()
132+
: form.values.date
133+
? new Date(form.values.date).toISOString()
134+
: undefined
129135
const updatedPresentation = response.data.presentations?.find((p) =>
130136
presentation
131137
? p.presentationId === presentation.presentationId
132-
: // For new presentation, pick the one with the latest scheduledAt
133-
p.scheduledAt ===
134-
(form.values.date instanceof Date
135-
? form.values.date.toISOString()
136-
: form.values.date
137-
? new Date(form.values.date).toISOString()
138-
: null),
138+
: // For new presentation, match by the freshly-submitted scheduledAt.
139+
// Guard against picking a record with scheduledAt === null when the form date is missing.
140+
targetScheduledAt !== undefined && p.scheduledAt === targetScheduledAt,
139141
)
140142

141143
onChange?.(updatedPresentation)

client/src/pages/ImprintPage/ImprintPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ const ImprintPage = () => {
1313
fetch('/imprint.html', { signal: controller.signal })
1414
.then((res) => res.text())
1515
.then((res) => setContent(res))
16-
.catch(() => {
17-
/* aborted or failed; leave content empty */
16+
.catch((err: unknown) => {
17+
if (err instanceof Error && err.name === 'AbortError') return
18+
console.warn('Failed to load imprint content', err)
1819
})
1920
return () => controller.abort()
2021
}, [])

client/src/pages/PrivacyPage/PrivacyPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ const PrivacyPage = () => {
1616
fetch('/privacy.html', { signal: controller.signal })
1717
.then((res) => res.text())
1818
.then((res) => setContent(res))
19-
.catch(() => {
20-
/* aborted or failed; leave content empty */
19+
.catch((err: unknown) => {
20+
if (err instanceof Error && err.name === 'AbortError') return
21+
console.warn('Failed to load privacy content', err)
2122
})
2223
return () => controller.abort()
2324
}, [])

0 commit comments

Comments
 (0)