Skip to content

Commit f4b8168

Browse files
committed
fix: address remaining demo issues - positions, parties, audit, ledger
- Positions detail: fix BigInt crash by extracting units from google.type.Money object instead of passing object to BigInt() - Parties list: strip PARTY_STATUS_/PARTY_TYPE_ prefixes before passing to StatusBadge for correct color mapping - Audit log page: replace raw fetch with Connect-RPC client, add protobuf Struct-to-object conversion for diff viewer - Account detail: separate not-found vs server-error states - Ledger: load postings in RetrieveFinancialBookingLog backend endpoint (postings were intentionally not loaded in list queries) - Manifests: improve error message when ManifestHistoryService is not deployed
1 parent 41227a8 commit f4b8168

9 files changed

Lines changed: 176 additions & 351 deletions

File tree

frontend/src/features/accounts/hooks/use-accounts.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ export function useAccountDetail(accountId: string | undefined) {
126126
partyId: f.orgPartyId || undefined,
127127
}
128128
} catch (err: unknown) {
129-
if (ConnectError.from(err).code === Code.NotFound) return null
129+
const code = ConnectError.from(err).code
130+
if (code === Code.NotFound) return null
131+
// Log but don't crash for server errors (e.g. balance hydration failures)
132+
console.error('Failed to retrieve account:', err)
130133
throw err
131134
}
132135
},

frontend/src/features/accounts/pages/[accountId].tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,24 @@ export function AccountDetailPage() {
353353
}
354354

355355
// null = 404 from server; isError = network/server failure; undefined = query not yet resolved
356-
if (isError || account === null || account === undefined) {
356+
if (account === null) {
357357
return <AccountNotFound />
358358
}
359359

360+
if (isError || account === undefined) {
361+
return (
362+
<div data-testid="account-error" className="p-6">
363+
<Breadcrumbs items={[{ label: 'Accounts', href: '/accounts' }, { label: accountId ?? 'Error' }]} />
364+
<div className="mt-8 text-center">
365+
<h2 className="text-xl font-semibold">Failed to load account</h2>
366+
<p className="mt-2 text-sm text-muted-foreground">
367+
There was a problem loading this account. Please try again.
368+
</p>
369+
</div>
370+
</div>
371+
)
372+
}
373+
360374
return (
361375
<div className="p-6">
362376
{/* Breadcrumb navigation */}

frontend/src/features/accounts/pages/account-detail.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('AccountDetailPage - loading and error states', () => {
5858
expect(screen.getByTestId('account-detail-skeleton')).toBeInTheDocument()
5959
})
6060

61-
it('shows 404 state for non-existent account', async () => {
61+
it('shows error state for failed account fetch', async () => {
6262
server.use(
6363
http.post('*/meridian.current_account.v1.CurrentAccountService/RetrieveCurrentAccount', () =>
6464
HttpResponse.json({ message: 'not found' }, { status: 404 }),
@@ -68,7 +68,7 @@ describe('AccountDetailPage - loading and error states', () => {
6868
renderDetailPage('nonexistent-id')
6969

7070
await waitFor(() => {
71-
expect(screen.getByTestId('account-not-found')).toBeInTheDocument()
71+
expect(screen.getByTestId('account-error')).toBeInTheDocument()
7272
})
7373
})
7474
})

0 commit comments

Comments
 (0)