Fixes wron assignment to modalItems after collection reset.

This commit is contained in:
Mateus Machado Luna 2019-03-12 18:57:16 -03:00
parent 5129b17b07
commit abec33df86
2 changed files with 7 additions and 4 deletions

View File

@ -615,7 +615,6 @@ registerBlockType('tainacan/items-list', {
tainacan.get(endpoint)
.then(response => {
for (let item of response.data) {
modalItems.push({
title: item.title,
@ -644,14 +643,16 @@ registerBlockType('tainacan/items-list', {
}
function resetCollections() {
itemsPage = 1;
collectionId = null;
collectionPage = 1;
modalItems = [];
setAttributes({
itemsPage: itemsPage,
collectionId: collectionId,
collectionPage: collectionPage,
modalItems: false
modalItems: modalItems
});
fetchModalCollections();
}

View File

@ -594,10 +594,12 @@ registerBlockType('tainacan/terms-list', {
function resetTaxonomies() {
taxonomyId = null;
taxonomyPage = 1;
modalTaxonomies = [];
setAttributes({
taxonomyId: taxonomyId,
taxonomyPage: taxonomyPage
taxonomyPage: taxonomyPage,
modalTaxonomies: modalTaxonomies
});
fetchModalTaxonomies();
}