From 7d76e0ac5c1544da0b742bde0af652706fcf9477 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Fri, 7 Feb 2020 10:43:44 +0000 Subject: [PATCH] Fix Osmose request resolving after UI moves on - Previously caused minor unexpected renderer behaviour by forcing elements visible when the user had moved on (potentially interfering with whatever they're currently doing) --- modules/ui/osmose_details.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/ui/osmose_details.js b/modules/ui/osmose_details.js index 22f43bce5..78a7be570 100644 --- a/modules/ui/osmose_details.js +++ b/modules/ui/osmose_details.js @@ -1,6 +1,7 @@ import { event as d3_event, - select as d3_select + select as d3_select, + selectAll as d3_selectAll } from 'd3-selection'; import { modeSelect } from '../modes/select'; @@ -105,12 +106,18 @@ export function uiOsmoseDetails(context) { .append('use') .attr('href', '#iD-icon-out-link'); + // Save current item to check if UI changed by time request resolves + const thisItem = _qaItem; services.osmose.loadIssueDetail(_qaItem) .then(d => { // No details to add if there are no associated issue elements if (!d.elems || d.elems.length === 0) return; - // TODO: Do nothing if UI has moved on by the time this resolves + // Do nothing if UI has moved on by the time this resolves + if ( + context.selectedErrorID() !== thisItem.id + && d3_selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty() + ) return; // Things like keys and values are dynamically added to a subtitle string if (d.detail) {