-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] Duplicate layer and add layer from config #1401
Conversation
src/reducers/vis-state-updaters.js
Outdated
@@ -896,6 +898,7 @@ export const removeFilterUpdater = (state, action) => { | |||
*/ | |||
export const addLayerUpdater = (state, action) => { | |||
const defaultDataset = Object.keys(state.datasets)[0]; | |||
if (props.type && state.layerClasses[props.type]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right. Was this line added by mistake?
src/reducers/vis-state-updaters.js
Outdated
let newLabel = `Copy of ${original.config.label}`; | ||
let postfix = 0; | ||
while (layers.find(l => l.config.label === newLabel)) { | ||
newLabel = `${newLabel} ${postfix++}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably generate something like Copy of My layer 0 1 2 3 4 5 6
and so on: starting with 0 and appending the next number to it every time. It'd be better to define some kind of template in a separate constant like Copy of ${layerName}${postfix}
and then replace the variables in the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
Signed-off-by: Valentine <[email protected]>
Signed-off-by: Valentine <[email protected]>
Signed-off-by: Valentine <[email protected]>
Signed-off-by: Valentine <[email protected]>
Signed-off-by: Shan He <[email protected]>
Signed-off-by: Shan He <[email protected]>
Signed-off-by: Shan He <[email protected]>
e7f7f94
to
35e5d76
Compare
No description provided.