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

View File

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