From 79b583c056ffafc27f650da6952aa4b81077bccb Mon Sep 17 00:00:00 2001 From: Jaden Diefenbaugh <jaden.diefenbaugh@idiap.ch> Date: Mon, 7 May 2018 11:02:04 +0200 Subject: [PATCH] [toolchain] fix block io removal removing unrelated conns, #98 --- conda/js/src/components/toolchain/ToolchainEditor.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/conda/js/src/components/toolchain/ToolchainEditor.jsx b/conda/js/src/components/toolchain/ToolchainEditor.jsx index d3ba2b64..62ef416f 100644 --- a/conda/js/src/components/toolchain/ToolchainEditor.jsx +++ b/conda/js/src/components/toolchain/ToolchainEditor.jsx @@ -575,14 +575,16 @@ export class ToolchainEditor extends React.PureComponent<Props, State> { deleteBlockIO = (blockName: string, set: BlockSet, ioType: 'input' | 'output', ioName: string) => { const rep = {...this.state.cache.contents.representation}; + const connectionLabel = `${ blockName }.${ ioName }`; + rep.connections = Object.entries(rep.connections).filter(([name, rep]) => { if(!name.includes(ioName)) return true; const [from, to] = name.split('/'); - if(ioType === 'input' && to.endsWith(`.${ ioName }`)) + if(ioType === 'input' && to === connectionLabel) return false; - if(ioType === 'output' && from.endsWith(`.${ ioName }`)) + if(ioType === 'output' && from === connectionLabel) return false; return true; }) @@ -603,9 +605,9 @@ export class ToolchainEditor extends React.PureComponent<Props, State> { return newBlock; }), connections: this.state.cache.contents.connections.filter(c => { - if(ioType === 'input' && c.to.endsWith(`.${ ioName }`)) + if(ioType === 'input' && c.to === connectionLabel) return false; - if(ioType === 'output' && c.from.endsWith(`.${ ioName }`)) + if(ioType === 'output' && c.from === connectionLabel) return false; return true; }), -- GitLab