/** @private */
handleModalCancel: function(modalMap, ev) {
- var prevNode = this.getPreviousModalMap();
+ var prevNode = this.getPreviousModalMap(),
+ resetTasks = Promise.resolve();
if (prevNode) {
- var heading = prevNode.parentNode.querySelector('h4');
+ var heading = prevNode.parentNode.querySelector('h4'),
+ prevMap = dom.findClassInstance(prevNode);
+
+ while (prevMap) {
+ resetTasks = resetTasks
+ .then(L.bind(prevMap.load, prevMap))
+ .then(L.bind(prevMap.reset, prevMap));
+
+ prevMap = prevMap.parent;
+ }
prevNode.classList.add('flash');
prevNode.classList.remove('hidden');
ui.hideModal();
}
- return Promise.resolve();
+ return resetTasks;
},
/** @private */