diff --git a/app/assets/v2/js/grants/index.js b/app/assets/v2/js/grants/index.js index 4f2c2b7e741..1736654a269 100644 --- a/app/assets/v2/js/grants/index.js +++ b/app/assets/v2/js/grants/index.js @@ -126,7 +126,8 @@ if (document.getElementById('grants-showcase')) { editingCollection: false, createCollectionRedirect: false, activeTimeout: null, - scrollTriggered: false + scrollTriggered: false, + previouslyLoadedGrants: {}, }, methods: { toggleStyle: function(style) { @@ -319,13 +320,13 @@ if (document.getElementById('grants-showcase')) { if (!append_mode) { vm.grants = []; + vm.prevouslyLoadedGrants = {}; } - const previouslyLoadedIds = vm.grants.map(grant => grant.id); - getGrants.grants.forEach(function(item) { - if (!previouslyLoadedIds.includes(item.id)) { + if (!vm.prevouslyLoadedGrants[item.id]) { vm.grants.push(item); + vm.previouslyLoadedGrants[item.id] = item; } });