@@ -51,7 +51,10 @@ import { formatHexColor } from "./DiscourseNodeCanvasSettings";
5151import posthog from "posthog-js" ;
5252import { getSetting , setSetting } from "~/utils/extensionSettings" ;
5353import { USE_REIFIED_RELATIONS } from "~/data/userSettings" ;
54- import { setGlobalSetting } from "~/components/settings/utils/accessors" ;
54+ import {
55+ setGlobalSetting ,
56+ getGlobalSettings ,
57+ } from "~/components/settings/utils/accessors" ;
5558
5659const DEFAULT_SELECTED_RELATION = {
5760 display : "none" ,
@@ -1070,6 +1073,9 @@ const DiscourseRelationConfigPanel: CustomField["options"]["component"] = ({
10701073 const handleDelete = ( rel : Relation ) => {
10711074 deleteBlock ( rel . uid ) ;
10721075 setRelations ( relations . filter ( ( r ) => r . uid !== rel . uid ) ) ;
1076+
1077+ const { [ rel . uid ] : _ , ...remaining } = getGlobalSettings ( ) . Relations ;
1078+ setGlobalSetting ( [ "Relations" ] , remaining ) ;
10731079 } ;
10741080 const handleDuplicate = ( rel : Relation ) => {
10751081 const baseText = rel . text
@@ -1099,7 +1105,15 @@ const DiscourseRelationConfigPanel: CustomField["options"]["component"] = ({
10991105 text,
11001106 children : stripUid ( copyTree ) ,
11011107 } ,
1102- } ) . then ( ( newUid ) =>
1108+ } ) . then ( ( newUid ) => {
1109+ const originalRelation = getGlobalSettings ( ) . Relations [ rel . uid ] ;
1110+ if ( originalRelation ) {
1111+ setGlobalSetting ( [ "Relations" , newUid ] , {
1112+ ...originalRelation ,
1113+ label : text ,
1114+ } ) ;
1115+ }
1116+
11031117 setRelations ( [
11041118 ...relations ,
11051119 {
@@ -1108,8 +1122,8 @@ const DiscourseRelationConfigPanel: CustomField["options"]["component"] = ({
11081122 destination : rel . destination ,
11091123 text,
11101124 } ,
1111- ] ) ,
1112- ) ;
1125+ ] ) ;
1126+ } ) ;
11131127 } ;
11141128 const handleBack = ( ) => {
11151129 setEditingRelation ( "" ) ;
0 commit comments