Skip to content

Commit

Permalink
Merge pull request #4196 from systeminit/fix/dont-show-edges-if-socke…
Browse files Browse the repository at this point in the history
…t-is-gone

Fix: dont show edge if socket is gone
  • Loading branch information
jobelenus authored Jul 23, 2024
2 parents a9f4e31 + 54ebdc8 commit a2e3741
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/web/src/store/components.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,17 @@ export const useComponentsStore = (forceChangeSetId?: ChangeSetId) => {
},

diagramEdges(): DiagramEdgeDef[] {
return _.filter(this.allEdges, (edge) => {
return (
!!this.componentsById[edge.toComponentId] &&
!!this.componentsById[edge.fromComponentId]
);
// filter out edge data if neither component exists
// or the toComponent Socket doesn't exist
return this.allEdges.filter((edge) => {
const toComponent = this.componentsById[edge.toComponentId];
if (!this.componentsById[edge.fromComponentId]) return false;
if (!toComponent) return false;
else if (
!toComponent.sockets.find((s) => s.id === edge.toSocketId)
)
return false;
return true;
});
},

Expand Down

0 comments on commit a2e3741

Please sign in to comment.