Skip to content

Commit

Permalink
Use hash generator for copied layer id
Browse files Browse the repository at this point in the history
Signed-off-by: Valentine <[email protected]>
  • Loading branch information
b2kdaman committed Dec 8, 2020
1 parent 330f2dc commit c72393e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/reducers/vis-state-updaters.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
import {assignGpuChannel, setFilterGpuMode} from 'utils/gpu-filter-utils';
import {createNewDataEntry, sortDatasetByColumn} from 'utils/dataset-utils';
import {set, toArray} from 'utils/utils';
import {generateHashId} from 'utils/utils';

import {calculateLayerData, findDefaultLayer} from 'utils/layer-utils';

Expand Down Expand Up @@ -942,7 +943,7 @@ export const removeLayerUpdater = (state, {idx}) => {
export const duplicateLayerUpdater = (state, {idx}) => {
const {layers, layerData} = state;
const layerToDuplicate = cloneDeep(state.layers[idx]);
layerToDuplicate.id = `${layerToDuplicate.config.id}_copy`;
layerToDuplicate.id = generateHashId();
layerToDuplicate.config.label = `Copy of ${layerToDuplicate.config.label}`;
const existingCopiesNum = layers.filter(l => l.id.includes(layerToDuplicate.id)).length;
if (existingCopiesNum) {
Expand Down

0 comments on commit c72393e

Please sign in to comment.