Remove lodash cloneDeep

(re #6087)

- some were able to do a different approach
    (validations/almost_junction, and settings/*)
- some were replaced with custom speedy cloners
   (in orthogonalize clonePoints and osm.js cloneNoteCache)
- some just replaced with JSON.parse(JSON.stringify()))
This commit is contained in:
Bryan Housel
2019-03-29 17:18:40 -04:00
parent d5abe468b9
commit 3673a7c7e7
6 changed files with 70 additions and 89 deletions
+8 -45
View File
@@ -1,52 +1,15 @@
import _cloneDeep from 'lodash-es/cloneDeep';
import { dispatch as d3_dispatch } from 'd3-dispatch';
import {
select as d3_select,
event as d3_event
} from 'd3-selection';
import { select as d3_select, event as d3_event } from 'd3-selection';
import { t } from '../../util/locale';
import { actionRestrictTurn, actionUnrestrictTurn } from '../../actions';
import { behaviorBreathe } from '../../behavior';
import {
geoExtent,
geoRawMercator,
geoVecScale,
geoVecSubtract,
geoZoomToScale
} from '../../geo';
import {
osmIntersection,
osmInferRestriction,
osmTurn,
osmWay
} from '../../osm';
import {
svgLayers,
svgLines,
svgTurns,
svgVertices
} from '../../svg';
import {
utilDisplayName,
utilDisplayType,
utilEntitySelector,
utilFunctor,
utilRebind
} from '../../util';
import { geoExtent, geoRawMercator, geoVecScale, geoVecSubtract, geoZoomToScale } from '../../geo';
import { osmIntersection, osmInferRestriction, osmTurn, osmWay } from '../../osm';
import { svgLayers, svgLines, svgTurns, svgVertices } from '../../svg';
import { utilDisplayName, utilDisplayType, utilEntitySelector, utilFunctor, utilRebind } from '../../util';
import { utilDetect } from '../../util/detect';
import {
utilGetDimensions,
utilSetDimensions
} from '../../util/dimensions';
import { utilGetDimensions, utilSetDimensions } from '../../util/dimensions';
export function uiFieldRestrictions(field, context) {
@@ -363,8 +326,8 @@ export function uiFieldRestrictions(field, context) {
} else if (datum.restrictionID && !datum.only) { // NO -> ONLY
var seen = {};
var datumOnly = _cloneDeep(datum);
datumOnly.only = true;
var datumOnly = JSON.parse(JSON.stringify(datum)); // deep clone the datum
datumOnly.only = true; // but change this property
restrictionType = restrictionType.replace(/^no/, 'only');
// Adding an ONLY restriction should destroy all other direct restrictions from the FROM towards the VIA.