diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-20 10:16:39 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-20 10:17:02 -0300 |
commit | 8c8aad4c21fde2cd37e25ccd4c723a308b79439b (patch) | |
tree | bb331bb101e31afca0144b1df82e75dc12a741f6 /packages/demobank-ui/src/components | |
parent | 5ae63982c3d0e31ddc7c4df389fe2ec2e0062906 (diff) | |
download | wallet-core-8c8aad4c21fde2cd37e25ccd4c723a308b79439b.tar.xz |
fix #7524: do not break if the account is in an invalid state
Diffstat (limited to 'packages/demobank-ui/src/components')
3 files changed, 9 insertions, 3 deletions
diff --git a/packages/demobank-ui/src/components/Transactions/index.ts b/packages/demobank-ui/src/components/Transactions/index.ts index 618fcfb71..0c9084946 100644 --- a/packages/demobank-ui/src/components/Transactions/index.ts +++ b/packages/demobank-ui/src/components/Transactions/index.ts @@ -55,7 +55,7 @@ export interface Transaction { negative: boolean; counterpart: string; when: AbsoluteTime; - amount: AmountJson; + amount: AmountJson | undefined; subject: string; } diff --git a/packages/demobank-ui/src/components/Transactions/state.ts b/packages/demobank-ui/src/components/Transactions/state.ts index ac76e31e2..5d613c5d0 100644 --- a/packages/demobank-ui/src/components/Transactions/state.ts +++ b/packages/demobank-ui/src/components/Transactions/state.ts @@ -114,7 +114,7 @@ export function useComponentState({ accountLabel, pageNumber, balanceValue }: Pr const when: AbsoluteTime = { t_ms: date.getTime() } - const amount = Amounts.parseOrThrow(`${anyItem.currency}:${anyItem.amount}`); + const amount = Amounts.parse(`${anyItem.currency}:${anyItem.amount}`); const subject = anyItem.subject; return { negative, diff --git a/packages/demobank-ui/src/components/Transactions/views.tsx b/packages/demobank-ui/src/components/Transactions/views.tsx index b3683b743..1822f9d94 100644 --- a/packages/demobank-ui/src/components/Transactions/views.tsx +++ b/packages/demobank-ui/src/components/Transactions/views.tsx @@ -54,7 +54,13 @@ export function ReadyView({ transactions }: State.Ready): VNode { </td> <td> {item.negative ? "-" : ""} - {Amounts.stringifyValue(item.amount)} {item.amount.currency} + {item.amount ? ( + `${Amounts.stringifyValue(item.amount)} ${ + item.amount.currency + }` + ) : ( + <span style={{ color: "grey" }}><invalid value></span> + )} </td> <td>{item.counterpart}</td> <td>{item.subject}</td> |