fix(audit): frontend HIGHs — surface fetch errors, kill href=#, invalidate queries, toast over alert

R2-H10: webhook-delivery-log and audit-log-list both swallowed fetch
errors silently — failed loads showed spinner forever or stale data.
Both now set a loadError state, show an inline retry banner, and fire
a toast.error. Same applies to audit-log loadMore.

R2-H11: audit-log-card rendered as `<a href="#">` — tapping on mobile
inserted `#` in the URL and scrolled to top (back-button trap).
ListCard now treats `href` as optional and renders a non-link `<div>`
when omitted; audit-log-card no longer passes href.

R2-H12: smart-archive-dialog only invalidated ['clients'] / ['berths']
/ ['interests']. Detail header kept showing Archived=false until hard
reload. Now also invalidates ['clients', clientId] and removes the
['client-archive-dossier', clientId] cache so re-open re-fetches.

R2-H13: client-list bulk mutation used native alert() on partial
failure (blocking the page) and had no onError handler. Replaced with
toast.warning / toast.success / toast.error.

1175/1175 vitest passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-05-06 22:18:14 +02:00
parent a8c6c071e6
commit 5fc68a5f34
6 changed files with 79 additions and 31 deletions

View File

@@ -7,8 +7,9 @@ import { type ReactNode } from 'react';
import { cn } from '@/lib/utils';
interface ListCardProps {
/** Detail-page URL the card navigates to when tapped. */
href: string;
/** Detail-page URL the card navigates to when tapped. Omit to render a
* non-navigating card (audit log entries, read-only rows). */
href?: string;
/**
* Optional Tailwind background class painted on a 3px vertical strip on the
* left edge - used to encode pipeline stage / status / category at a glance.
@@ -41,6 +42,12 @@ export function ListCard({
className,
children,
}: ListCardProps) {
const innerClassName = cn(
'block p-3',
accentClassName && 'pl-4',
'rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
);
return (
<article
className={cn(
@@ -52,17 +59,15 @@ export function ListCard({
{accentClassName ? (
<span aria-hidden className={cn('absolute inset-y-0 left-0 w-1', accentClassName)} />
) : null}
<Link
href={href as Route}
aria-label={ariaLabel}
className={cn(
'block p-3',
accentClassName && 'pl-4',
'rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
)}
>
{children}
</Link>
{href ? (
<Link href={href as Route} aria-label={ariaLabel} className={innerClassName}>
{children}
</Link>
) : (
<div aria-label={ariaLabel} className={innerClassName}>
{children}
</div>
)}
{actions ? <div className="absolute right-1.5 top-1.5">{actions}</div> : null}
</article>
);