mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Create an issue key property that changes when data needs refresh
(closes #8655)
This commit is contained in:
@@ -14,6 +14,7 @@ export function validationIssue(attrs) {
|
||||
this.hash = attrs.hash; // optional - string to further differentiate the issue
|
||||
|
||||
this.id = generateID.apply(this); // generated - see below
|
||||
this.key = generateKey.apply(this); // generated - see below (call after generating this.id)
|
||||
this.autoFix = null; // generated - if autofix exists, will be set below
|
||||
|
||||
// A unique, deterministic string hash.
|
||||
@@ -39,6 +40,13 @@ export function validationIssue(attrs) {
|
||||
return parts.join(':');
|
||||
}
|
||||
|
||||
// An identifier suitable for use as the second argument to d3.selection#data().
|
||||
// (i.e. this should change whenever the data needs to be refreshed)
|
||||
function generateKey() {
|
||||
return this.id + ':' + Date.now().toString(); // include time of creation
|
||||
}
|
||||
|
||||
|
||||
this.extent = function(resolver) {
|
||||
if (this.loc) {
|
||||
return geoExtent(this.loc);
|
||||
|
||||
@@ -43,7 +43,7 @@ export function uiCommitWarnings(context) {
|
||||
|
||||
|
||||
var items = container.select('ul').selectAll('li')
|
||||
.data(issues, function(d) { return d.id; });
|
||||
.data(issues, function(d) { return d.key; });
|
||||
|
||||
items.exit()
|
||||
.remove();
|
||||
|
||||
@@ -55,7 +55,7 @@ export function uiSectionEntityIssues(context) {
|
||||
_activeIssueID = _issues.length > 0 ? _issues[0].id : null;
|
||||
|
||||
var containers = selection.selectAll('.issue-container')
|
||||
.data(_issues, function(d) { return d.id; });
|
||||
.data(_issues, function(d) { return d.key; });
|
||||
|
||||
// Exit
|
||||
containers.exit()
|
||||
|
||||
@@ -73,7 +73,7 @@ export function uiSectionValidationIssues(id, severity, context) {
|
||||
|
||||
|
||||
var items = list.selectAll('li')
|
||||
.data(issues, function(d) { return d.id; });
|
||||
.data(issues, function(d) { return d.key; });
|
||||
|
||||
// Exit
|
||||
items.exit()
|
||||
|
||||
Reference in New Issue
Block a user