From 5779b12e6a007806acd1d3194b85b2934c1201f4 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 26 Apr 2022 21:31:21 -0500 Subject: [PATCH] Fix getSavedAppBundles not keeping in memoryr --- build-lists.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/build-lists.js b/build-lists.js index e1b988a..ab73015 100644 --- a/build-lists.js +++ b/build-lists.js @@ -143,22 +143,26 @@ class BuildLists { } bundles = [] - async getSavedAppBundles ({ keepBundlesInMemory = true }) { + async getSavedAppBundles ( options = {} ) { + const { + keepBundlesInMemory = true + } = options + if ( !keepBundlesInMemory ) { + // console.log('Getting bundles from file') return await fs.readJson('./static/app-bundles.json') } // From here we get and store bundles - - console.log('this.bundles.length', this.bundles.length) + // Check if any bundles are already in memory - if ( this.bundles.length > 0 ) { - return this.bundles + if ( this.bundles.length === 0 ) { + // console.log('Storing bundles to memory') + this.bundles = await fs.readJson('./static/app-bundles.json') } - - this.bundles = await fs.readJson('./static/app-bundles.json') - + + // console.log('Getting bundles from memory') return this.bundles }