Skip to content

Commit

Permalink
fix: handle null
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Aug 12, 2024
1 parent e4a356a commit 0031551
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions components/workspace/use-cli-commands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,12 @@ function AuditReportResult({ codeHash }: { codeHash: string }) {
"border-t-0": index !== 0,
})}
>
<p>Original: {i.Detail.Original}</p>
<p>Suggested: {i.Detail.Updated}</p>
{i.Detail ? (
<>
<p>Original: {i.Detail.Original}</p>
<p>Suggested: {i.Detail.Updated}</p>
</>
) : null}
</div>
))}
</td>
Expand Down
4 changes: 3 additions & 1 deletion data/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const auditReportSchema = z.record(
z.object({
Description: z.string(),
Content: z.string(),
Detail: z.object({ Original: z.string(), Updated: z.string() }),
Detail: z
.object({ Original: z.string(), Updated: z.string() })
.or(z.null()),
})
)
);
Expand Down

0 comments on commit 0031551

Please sign in to comment.