diff --git a/lib/metadataTypes/List.js b/lib/metadataTypes/List.js index 475aa2db3..eda7145c4 100644 --- a/lib/metadataTypes/List.js +++ b/lib/metadataTypes/List.js @@ -53,21 +53,23 @@ class List extends MetadataType { */ static async retrieveForCache() { const results = await this.retrieve(); - if (!cache.getCache()?.folder) { - const subTypeArr = [ - 'list', - 'mysubs', - 'suppression_list', - 'publication', - 'contextual_suppression_list', - ]; - Util.logger.debug('folders not cached but required for list'); - Util.logger.info(' - Caching dependent Metadata: folder'); - Util.logSubtypes(subTypeArr); - Folder.client = this.client; - Folder.buObject = this.buObject; - Folder.properties = this.properties; - const result = await Folder.retrieveForCache(null, subTypeArr); + const subTypeArr = [ + 'list', + 'mysubs', + 'suppression_list', + 'publication', + 'contextual_suppression_list', + ]; + Util.logger.debug('folders not cached but required for list'); + Util.logger.info(' - Caching dependent Metadata: folder'); + Util.logSubtypes(subTypeArr); + Folder.client = this.client; + Folder.buObject = this.buObject; + Folder.properties = this.properties; + const result = await Folder.retrieveForCache(null, subTypeArr); + if (cache.getCache()?.folder) { + cache.mergeMetadata('folder', result.metadata); + } else { cache.setMetadata('folder', result.metadata); } for (const metadataEntry in results.metadata) {