Skip to content

Commit

Permalink
Disable editing of a deleted connection (fixes associated crash)
Browse files Browse the repository at this point in the history
  • Loading branch information
bindeali committed Sep 12, 2024
1 parent 43e978e commit 99e8f96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 8 additions & 10 deletions src/main/DiagramCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,10 @@ export default class DiagramCanvas extends React.Component<Props> {
AppSettings.selectedLinks.includes(linkView.model.id as string) &&
AppSettings.selectedLinks.length === 1
)
addLinkTools(
linkView,
this.props.performTransaction,
this.props.updateElementPanel
);
addLinkTools(linkView, this.props.performTransaction, () => {
this.props.updateElementPanel();
this.props.updateDetailPanel(DetailPanelMode.HIDDEN);
});
},
/**
* Mouse leave on cell:
Expand Down Expand Up @@ -473,11 +472,10 @@ export default class DiagramCanvas extends React.Component<Props> {
unHighlightAll();
}
highlightCells(CellColors.detail, id);
addLinkTools(
linkView,
this.props.performTransaction,
this.props.updateElementPanel
);
addLinkTools(linkView, this.props.performTransaction, () => {
this.props.updateElementPanel();
this.props.updateDetailPanel(DetailPanelMode.HIDDEN);
});
this.props.updateDetailPanel(DetailPanelMode.LINK, id);
}
},
Expand Down
6 changes: 4 additions & 2 deletions src/panels/detail/components/LinkControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ export const LinkControls: React.FC<Props> = (props: Props) => {
const iri = WorkspaceLinks[props.id].iri;
const queries: string[] = [];
const link = graph.getLinks().find((link) => link.id === props.id);
if (!link)
console.error(
if (!link) {
console.warn(
"Link " + props.id + " to be edited couldn't be found on the canvas."
);
return;
}
if (AppSettings.representation === Representation.FULL) {
setLabels(link!);
queries.push(updateTermConnections(props.id));
Expand Down

0 comments on commit 99e8f96

Please sign in to comment.