Skip to content

Commit 84df805

Browse files
committed
fix(cu): add optional chaining
1 parent 42c50a9 commit 84df805

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

servers/cu/src/domain/lib/loadMessages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,13 @@ function reconcileBlocksWith ({ logger, loadBlocksMeta, findBlocks, saveBlocks,
349349
.map((fromDb) => findMissingBlocksIn(fromDb, { min, maxTimestamp }))
350350
.chain((missingRange) => {
351351
if (!missingRange) return Resolved(fromDb)
352-
const latestBlocksMatch = missingRange.min === fromDb[fromDb.length - 1].height
352+
const latestBlocksMatch = missingRange?.min === fromDb?.[fromDb?.length - 1]?.height
353353
if (latestBlocksMatch) {
354354
logger('Latest blocks match at height %d. Checking Arweave for latest block', missingRange.min)
355355
return of()
356356
.chain(getLatestBlock)
357357
.chain((latestBlock) => {
358-
if (latestBlock === missingRange.min) {
358+
if (latestBlock === missingRange?.min) {
359359
logger('Latest block matches missing range min height %d. Bypassing GQL call', missingRange.min)
360360
return Resolved(fromDb)
361361
}

0 commit comments

Comments
 (0)