Skip to content

Commit 95735a2

Browse files
Refactor transaction params rendering with explicit empty check
Co-authored-by: joaquim.verges <[email protected]>
1 parent c5e175c commit 95735a2

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/transactions/tx/[id]/transaction-details-ui.tsx

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,33 @@ export function TransactionDetailsUI({
248248
<CardTitle className="text-lg">Transaction Parameters</CardTitle>
249249
</CardHeader>
250250
<CardContent>
251-
{transaction.transactionParams &&
252-
transaction.transactionParams.length > 0 ? (
253-
<CodeClient
254-
code={JSON.stringify(transaction.transactionParams, null, 2)}
255-
lang="json"
256-
/>
257-
) : (
258-
<p className="text-muted-foreground text-sm">
259-
No transaction parameters available
260-
</p>
261-
)}
251+
{(() => {
252+
// Check if transaction parameters exist using for...of loop
253+
if (!transaction.transactionParams) {
254+
return (
255+
<p className="text-muted-foreground text-sm">
256+
No transaction parameters available
257+
</p>
258+
);
259+
}
260+
261+
let hasParams = false;
262+
for (const _param of transaction.transactionParams) {
263+
hasParams = true;
264+
break;
265+
}
266+
267+
return hasParams ? (
268+
<CodeClient
269+
code={JSON.stringify(transaction.transactionParams, null, 2)}
270+
lang="json"
271+
/>
272+
) : (
273+
<p className="text-muted-foreground text-sm">
274+
No transaction parameters available
275+
</p>
276+
);
277+
})()}
262278
</CardContent>
263279
</Card>
264280
{errorMessage && (

0 commit comments

Comments
 (0)