From 47d14885e53875b937954bd9c461e311bebe6ba4 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Wed, 2 Oct 2024 12:46:05 +0700 Subject: [PATCH] UBERF-8324: Fix null in external sync and todos (#6777) Signed-off-by: Andrey Sobolev --- services/github/pod-github/src/sync/pullrequests.ts | 10 ++++++---- services/github/pod-github/src/sync/utils.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/services/github/pod-github/src/sync/pullrequests.ts b/services/github/pod-github/src/sync/pullrequests.ts index 6851996840..f3a38c9fe5 100644 --- a/services/github/pod-github/src/sync/pullrequests.ts +++ b/services/github/pod-github/src/sync/pullrequests.ts @@ -700,10 +700,12 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS const approvedOrChangesRequested = new Map, PullRequestReviewState>() const reviewStates = new Map, PullRequestReviewState[]>() - const sortedReviews: (Review & { date: number })[] = external.reviews.nodes.map((it) => ({ - ...it, - date: new Date(it.updatedAt ?? it.submittedAt ?? it.createdAt).getTime() - })) + const sortedReviews: (Review & { date: number })[] = external.reviews.nodes + .filter((it) => it != null) + .map((it) => ({ + ...it, + date: new Date(it.updatedAt ?? it.submittedAt ?? it.createdAt).getTime() + })) for (const it of external.latestReviews.nodes) { if (sortedReviews.some((qt) => it.id === qt.id)) { diff --git a/services/github/pod-github/src/sync/utils.ts b/services/github/pod-github/src/sync/utils.ts index dd62c13f0c..21ba8041d7 100644 --- a/services/github/pod-github/src/sync/utils.ts +++ b/services/github/pod-github/src/sync/utils.ts @@ -346,7 +346,7 @@ export async function syncDerivedDocuments ( }) const processed = new Set>() - const _docs = docs(ext) + const _docs = docs(ext).filter((it) => it != null) for (const r of _docs) { const existing = childDocsOfClass.find((it) => it.url.toLowerCase() === r.url.toLowerCase()) if (existing === undefined) {