Commit 79b583c0 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[toolchain] fix block io removal removing unrelated conns, #98

parent 7d1f82f7
Pipeline #19896 passed with stages
in 121 minutes and 46 seconds
...@@ -575,14 +575,16 @@ export class ToolchainEditor extends React.PureComponent<Props, State> { ...@@ -575,14 +575,16 @@ export class ToolchainEditor extends React.PureComponent<Props, State> {
deleteBlockIO = (blockName: string, set: BlockSet, ioType: 'input' | 'output', ioName: string) => { deleteBlockIO = (blockName: string, set: BlockSet, ioType: 'input' | 'output', ioName: string) => {
const rep = {...this.state.cache.contents.representation}; const rep = {...this.state.cache.contents.representation};
const connectionLabel = `${ blockName }.${ ioName }`;
rep.connections = Object.entries(rep.connections).filter(([name, rep]) => { rep.connections = Object.entries(rep.connections).filter(([name, rep]) => {
if(!name.includes(ioName)) if(!name.includes(ioName))
return true; return true;
const [from, to] = name.split('/'); const [from, to] = name.split('/');
if(ioType === 'input' && to.endsWith(`.${ ioName }`)) if(ioType === 'input' && to === connectionLabel)
return false; return false;
if(ioType === 'output' && from.endsWith(`.${ ioName }`)) if(ioType === 'output' && from === connectionLabel)
return false; return false;
return true; return true;
}) })
...@@ -603,9 +605,9 @@ export class ToolchainEditor extends React.PureComponent<Props, State> { ...@@ -603,9 +605,9 @@ export class ToolchainEditor extends React.PureComponent<Props, State> {
return newBlock; return newBlock;
}), }),
connections: this.state.cache.contents.connections.filter(c => { connections: this.state.cache.contents.connections.filter(c => {
if(ioType === 'input' && c.to.endsWith(`.${ ioName }`)) if(ioType === 'input' && c.to === connectionLabel)
return false; return false;
if(ioType === 'output' && c.from.endsWith(`.${ ioName }`)) if(ioType === 'output' && c.from === connectionLabel)
return false; return false;
return true; return true;
}), }),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment