Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions apps/roam/src/components/CreateRelationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,18 @@ const CreateRelationDialog = ({
});
return null;
}
if (candidateRelations.length !== 1) {
// This seems to happen... I need more data.
internalError({
type: "Create Relation dialog",
error: `Too many relations between ${selectedTargetType.type} and ${selectedSourceType.type}: ${candidateRelations.map((r) => r.id).join(",")}`,
});
return null;
if (candidateRelations.length > 1) {
// Control for one very innocuous case: Many times the same relation, with different triples.
const setOfRels = new Set(
candidateRelations.map((r) => (r.forward ? r.id : `-${r.id}`)),
);
if (setOfRels.size > 1) {
internalError({
type: "Create Relation dialog",
error: `Too many relations between ${selectedTargetType.type} and ${selectedSourceType.type}: ${[...setOfRels].join(",")}`,
});
// let it still fall through to the first
}
}
return candidateRelations[0];
};
Expand Down