Resolving Changeset already inflight error when editing with 2 layers w/in map#1427
Resolving Changeset already inflight error when editing with 2 layers w/in map#1427jackgrossman18 wants to merge 36 commits intohoot2xfrom
Conversation
| /** | ||
| * Get all id's necessary to create new map features | ||
| * | ||
| * @param {Promise|array} mapId + changesetId, nodeId, wayId, relationId |
There was a problem hiding this comment.
Just a reminder, let's update this comment!
| return this.request( params ) | ||
| .then( resp => { | ||
|
|
||
| let activeIds = {}; |
There was a problem hiding this comment.
I think just return resp.data!
| utilQsString, | ||
| utilStringQs | ||
| } from '../../../util'; | ||
| import { diff3MergeIndices } from 'node-diff3'; |
There was a problem hiding this comment.
think we can remove this import!
| context.surface().classed('nope-disabled', d3_event.altKey); | ||
|
|
||
| // add one more boolean at end, is activeLayer===mapId | ||
| var _activeLayer = _find( Hoot.layers.loadedLayers, function(a, b) { return a.activeLayer; }); |
There was a problem hiding this comment.
I think we need to make use of this here, making sure to only apply a target loc if active ids match.
here in iD a question is asked (is this target loc one that allows vertex).
Our question needs to be does the datum's mapId equal the _activeLayer mapId
| } | ||
|
|
||
| var _activeLayer = _find(Hoot.layers.loadedLayers, function(a, b) { return a.activeLayer; }); | ||
| if (_activeLayer && _activeLayer.id) { |
There was a problem hiding this comment.
totally just a stylistic suggestion, so no need to change, but I almost wonder if we should make a new func for grabbing the ids from the active layer. something like osmEntity.id.hoot that looks a little like this...
function(type, activeLayer) {
return osmEntity.id.fromOsm(type, activeLayer.activeIds[type]--) + '_' + activeLayer.id;
}Then here in this if block you just say "do I have an activeLayer'?
Ok I do, use id.hoot function
If I don't use the out of the box id way of doing things.
just a thought!
|
@maxgrossman please take a look at the most recent changes |
| let changeActive = new LayerAdd(); | ||
|
|
||
|
|
||
| if (d3.select('#reference button.select-active-layer').empty()) { |
There was a problem hiding this comment.
wonder if the on click callback can be generalized in a single function? seems like when we click one fo the active layer buttons, we make the one we click's classes all set to active, and the other one's set to false. so a function could have 2 params, one we want to set to active, one we want to disable and just use those accordingly.
so naively, something like
function update(active, inactive) {
//...update active button class
//...update inactive button
}|
|
||
| // Connect the way to an existing node and continue drawing. | ||
| drawWay.addNode = function(node, d) { | ||
| console.log(node); |
There was a problem hiding this comment.
let's remove the stray console logs
| context.surface().classed('nope-disabled', d3_event.altKey); | ||
|
|
||
| var _activeLayer = _find( Hoot.layers.loadedLayers, function(a,b) { return a.activeLayer; }); | ||
| var targetLoc = datum && datum.properties && datum.properties.entity && datum.properties.entity.loc; |
There was a problem hiding this comment.
I think we need to implement the commented out piece here, using the same split stuff we do in the draw.js file.
| } | ||
|
|
||
| // again, boolean, is entity.mapId === activeLayerId... | ||
| var suppressed = _altDisables && d3_event && d3_event.altKey; |
There was a problem hiding this comment.
need to do same is this the active layer check here too
| var _activeLayer = _find(Hoot.layers.loadedLayers, function(a, b) { return a.activeLayer; }); | ||
| let allIds = {}; | ||
| allIds = _activeLayer.activeIds; | ||
| var id = osmEntity.id.fromOSM(type, allIds[type]--); |
There was a problem hiding this comment.
I think you can call the _activeLayer.activeIds directly inside the fromOsm function _activeLayer.activeIds[type]--
| } from '../util'; | ||
|
|
||
| import { baseUrl as hootBaseUrl } from '../Hoot/config/apiConfig'; | ||
| import { all } from 'q'; |
There was a problem hiding this comment.
import to remove I do believe
| import _groupBy from 'lodash-es/groupBy'; | ||
| import _isEmpty from 'lodash-es/isEmpty'; | ||
| import _map from 'lodash-es/map'; | ||
| import _matches from 'lodash-es/matches'; |
|
@maxgrossman please take a look at the new changes |
|
The changeset upload logic is 👨🍳 💋 - made changes to both the secondary and reference datasets, then checked their respective changesets/nodes tables. they had the right changes. Awesome job. In addition to those comments, I found these bugs. sometimes I can't double click off when finishing drawing a way.I cannot drag nodes that belong to features within the currently active layerIf you notice in the first gif how the icon changes. I think that indicates the mode is changing. For debugging why this is happening, it might be helpful to look at the context's |
# Conflicts: # modules/Hoot/managers/api.js # package-lock.json
|
@maxgrossman @brianhatchl this is ready for review |


ref #1425