Skip to content

Commit 77e7e23

Browse files
authored
Disallow moving relation endpoint if the relation after move already exists (#126)
1 parent b602b9a commit 77e7e23

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
77
#### 🐛 Fixed
88
- Fix stale rendering (i.e. missing links after moving an endpoint until an element move) due to the lost scheduled layer updates.
99
- Fix unable to scroll inside canvas components and templates when `requireCtrl` in `zoomOptions` is set `false`.
10+
- Disallow moving relation source or target to another entity in authoring mode if the relation after move already exists on the canvas.
1011
- Disable changing an entity IRI in a form when `MetadataProvider.canModifyEntity()` disallows it.
1112
- Move link vertices together with source and target elements if both are selected in `Selection` component.
1213

src/widgets/visualAuthoring/dragEditLayer.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,17 @@ export function DragEditLayer(props: DragEditLayerProps) {
113113
return new EntityDragConnection([], workspace);
114114
}
115115

116+
const linkTypeId = link.data.linkTypeId === PlaceholderRelationType
117+
? undefined : link.data.linkTypeId;
118+
if (target && linkTypeId && model.findLink(linkTypeId, source.id, target.id)) {
119+
// Link already exists
120+
return new EntityDragConnection([], workspace);
121+
}
122+
116123
const canConnect = await metadataProvider.canConnect(
117124
source.data,
118125
target?.data,
119-
link.data.linkTypeId === PlaceholderRelationType
120-
? undefined : link.data.linkTypeId,
126+
linkTypeId,
121127
{signal}
122128
);
123129
return new EntityDragConnection(canConnect, workspace);

0 commit comments

Comments
 (0)