From 226c4f88e1567a6533bcddab61bcb5f5a6a26518 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Tue, 29 Jan 2019 11:10:12 -0500 Subject: [PATCH] Re-run validation automatically upon merging fetched remote data into the history --- modules/core/context.js | 6 ++++++ modules/core/history.js | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/core/context.js b/modules/core/context.js index 9c910fbe9..c41f772ae 100644 --- a/modules/core/context.js +++ b/modules/core/context.js @@ -465,6 +465,12 @@ export function coreContext() { issueManager.validate(); } }); + // re-run validation upon merging fetched data + history.on('merge', function(entities) { + if (entities && entities.length > 0) { + issueManager.validate(); + } + }); // Debounce save, since it's a synchronous localStorage write, // and history changes can happen frequently (e.g. when dragging). diff --git a/modules/core/history.js b/modules/core/history.js index f4bc04fc7..0765bcb6e 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -32,7 +32,7 @@ import { export function coreHistory(context) { - var dispatch = d3_dispatch('change', 'annotatedChange', 'undone', 'redone'); + var dispatch = d3_dispatch('change', 'annotatedChange', 'merge', 'undone', 'redone'); var lock = utilSessionMutex('lock'); var duration = 150; var _imageryUsed = []; @@ -144,6 +144,7 @@ export function coreHistory(context) { _tree.rebase(entities, false); dispatch.call('change', this, undefined, extent); + dispatch.call('merge', this, entities); },