From 215d149005f4c7b24b57dcf6e7f41d384ceff588 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 30 Jul 2021 16:39:15 +0100 Subject: [PATCH 1/2] fix: remove optional chaining It's not supported in some environments - jest, etc. --- migrations/migration-9/pin-set.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/migration-9/pin-set.js b/migrations/migration-9/pin-set.js index 43008b9..edb0182 100644 --- a/migrations/migration-9/pin-set.js +++ b/migrations/migration-9/pin-set.js @@ -237,7 +237,7 @@ function storeItems (blockstore, items) { await blockstore.put(cid, buf) - let size = child.Links.reduce((acc, curr) => acc + (curr?.Tsize || 0), 0) + buf.length + let size = child.Links.reduce((acc, curr) => acc + (curr && curr.Tsize || 0), 0) + buf.length fanoutLinks[binIdx] = { Name: '', From d5d019c42f4f5c714f346b1b3c0a65467f187844 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 30 Jul 2021 17:03:24 +0100 Subject: [PATCH 2/2] chore: curr is always defined --- migrations/migration-9/pin-set.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/migration-9/pin-set.js b/migrations/migration-9/pin-set.js index edb0182..9a89d70 100644 --- a/migrations/migration-9/pin-set.js +++ b/migrations/migration-9/pin-set.js @@ -237,7 +237,7 @@ function storeItems (blockstore, items) { await blockstore.put(cid, buf) - let size = child.Links.reduce((acc, curr) => acc + (curr && curr.Tsize || 0), 0) + buf.length + let size = child.Links.reduce((acc, curr) => acc + (curr.Tsize || 0), 0) + buf.length fanoutLinks[binIdx] = { Name: '',