From 848961dc255e3ef2c8780f48d28ec702de1949b0 Mon Sep 17 00:00:00 2001 From: ajmaley Date: Sun, 25 Nov 2018 14:11:47 -0500 Subject: [PATCH] Dealt with duplicate key error messages and galleries re-rendering when selecting teh quiz or galleries dropdowns --- src/components/FlameLinkCollectionGallery.js | 17 +++++++++-------- .../FlameLinkCollectionGalleryContent.js | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/FlameLinkCollectionGallery.js b/src/components/FlameLinkCollectionGallery.js index 8f4910b..0e53917 100644 --- a/src/components/FlameLinkCollectionGallery.js +++ b/src/components/FlameLinkCollectionGallery.js @@ -31,7 +31,7 @@ class FlameLinkCollectionGallery extends Component { super(props); global.mediaURLs = []; - global.mediaIDs = []; + //global.mediaIDs = []; this.state = { schemaDetails: '', @@ -60,25 +60,26 @@ class FlameLinkCollectionGallery extends Component { getGalleryInfo(schemaDetails, schemaContent) { var key; - var mediaNums = [] + var mediaNums = []; + var mediaIDs = []; for (var val in schemaDetails) { key = schemaDetails[val].key } for (var val1 in schemaContent) { for (var val2 in schemaContent[val1][key]) { - global.mediaIDs.push(schemaContent[val1][key][val2]); + mediaIDs.push(schemaContent[val1][key][val2]); } } - for (var val3 in global.mediaIDs) { + for (var val3 in mediaIDs) { mediaNums.push(val3) } - return mediaNums.map(this.createGallery); + return mediaNums.map(this.createGallery, mediaIDs); } - createGallery = num => { - return + createGallery(num) { + return } render() { @@ -92,7 +93,7 @@ class FlameLinkCollectionGallery extends Component { - + diff --git a/src/components/FlameLinkCollectionGalleryContent.js b/src/components/FlameLinkCollectionGalleryContent.js index 9e34d5e..d93c7de 100644 --- a/src/components/FlameLinkCollectionGalleryContent.js +++ b/src/components/FlameLinkCollectionGalleryContent.js @@ -12,7 +12,7 @@ class FlameLinkCollectionGalleryContent extends Component { mediaURL: '', } - flamelinkApp.storage.getURL(global.mediaIDs[this.props.num]) + flamelinkApp.storage.getURL(this.props.mediaIDs[this.props.num]) .then(url => this.setState({ mediaURL: url }))