Skip to content

Commit ba5af21

Browse files
Alex KrawiecAlex Krawiec
authored andcommitted
fix undefined arrays bug
1 parent 47f7a92 commit ba5af21

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/components/changelog/docsChangelog.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ export async function DocsChangelog() {
4646
{entries.map(entry => {
4747
const date = new Date(entry.publishedAt);
4848
const totalFiles =
49-
(entry.filesChanged?.added.length || 0) +
50-
(entry.filesChanged?.modified.length || 0) +
51-
(entry.filesChanged?.removed.length || 0);
49+
(entry.filesChanged?.added?.length || 0) +
50+
(entry.filesChanged?.modified?.length || 0) +
51+
(entry.filesChanged?.removed?.length || 0);
5252

5353
return (
5454
<article
@@ -93,7 +93,7 @@ export async function DocsChangelog() {
9393
View changed files
9494
</summary>
9595
<div className="mt-2 space-y-2 rounded-md bg-gray-50 p-3">
96-
{entry.filesChanged.added.length > 0 && (
96+
{entry.filesChanged.added && entry.filesChanged.added.length > 0 && (
9797
<div>
9898
<span className="font-semibold text-green-700">Added:</span>
9999
<ul className="ml-4 mt-1 list-inside list-disc">
@@ -105,7 +105,7 @@ export async function DocsChangelog() {
105105
</ul>
106106
</div>
107107
)}
108-
{entry.filesChanged.modified.length > 0 && (
108+
{entry.filesChanged.modified && entry.filesChanged.modified.length > 0 && (
109109
<div>
110110
<span className="font-semibold text-blue-700">Modified:</span>
111111
<ul className="ml-4 mt-1 list-inside list-disc">
@@ -117,7 +117,7 @@ export async function DocsChangelog() {
117117
</ul>
118118
</div>
119119
)}
120-
{entry.filesChanged.removed.length > 0 && (
120+
{entry.filesChanged.removed && entry.filesChanged.removed.length > 0 && (
121121
<div>
122122
<span className="font-semibold text-red-700">Removed:</span>
123123
<ul className="ml-4 mt-1 list-inside list-disc">

0 commit comments

Comments
 (0)