Skip to content

Commit 6888222

Browse files
authored
ENG-1531 fix(roam): keep duplicated relation labels unchanged (#879)
1 parent b10cda1 commit 6888222

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

apps/roam/src/components/settings/DiscourseRelationConfigPanel.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,20 +1069,7 @@ const DiscourseRelationConfigPanel: CustomField["options"]["component"] = ({
10691069
setGlobalSetting(["Relations"], remaining);
10701070
};
10711071
const handleDuplicate = (rel: Relation) => {
1072-
const baseText = rel.text
1073-
.split(" ")
1074-
.filter((s) => !/^\(\d+\)$/.test(s))
1075-
.join(" ");
1076-
const copy = relations.reduce((p, c) => {
1077-
if (c.text.startsWith(baseText)) {
1078-
const copyIndex = Number(/\((\d+)\)$/.exec(c.text)?.[1]);
1079-
if (copyIndex && copyIndex > p) {
1080-
return copyIndex;
1081-
}
1082-
}
1083-
return p;
1084-
}, 0);
1085-
const text = `${rel.text} (${copy + 1})`;
1072+
const text = rel.text;
10861073
const copyTree = getBasicTreeByParentUid(rel.uid);
10871074
const stripUid = (n: RoamBasicNode[]): InputTextNode[] =>
10881075
n.map((c) => ({

0 commit comments

Comments
 (0)