@@ -331,49 +331,49 @@ const SuggestionsBody = ({
331331 rel . destination === discourseNode . type ) ||
332332 ( rel . destination === node . type && rel . source === discourseNode . type ) ,
333333 ) ;
334- if ( ! relevantRelns . length ) {
335- renderToast ( {
336- id : "suggestions-create-block-error" ,
337- content : "Could not identify a relevant relation" ,
338- intent : "danger" ,
339- timeout : 5000 ,
340- } ) ;
341- return ;
342- }
343- if ( relevantRelns . length > 1 ) {
344- // I don't want to panick the user with this.
345- // TODO: Maybe think of adding a relation type picker?
346- console . warn ( "Picking an arbitrary relation" ) ;
347- }
348- const rel = relevantRelns [ 0 ] ;
349- try {
350- if ( rel . destination === node . type )
351- await createReifiedRelation ( {
352- sourceUid : tagUid ,
353- destinationUid : node . uid ,
354- relationBlockUid : rel . id ,
355- } ) ;
356- else
357- await createReifiedRelation ( {
358- sourceUid : node . uid ,
359- destinationUid : tagUid ,
360- relationBlockUid : rel . id ,
334+ if ( relevantRelns . length ) {
335+ if ( relevantRelns . length > 1 ) {
336+ // I don't want to panick the user with this.
337+ // TODO: Maybe think of adding a relation type picker?
338+ console . warn ( "Picking an arbitrary relation" ) ;
339+ }
340+ const rel = relevantRelns [ 0 ] ;
341+ try {
342+ if ( rel . destination === node . type )
343+ await createReifiedRelation ( {
344+ sourceUid : tagUid ,
345+ destinationUid : node . uid ,
346+ relationBlockUid : rel . id ,
347+ } ) ;
348+ else
349+ await createReifiedRelation ( {
350+ sourceUid : node . uid ,
351+ destinationUid : tagUid ,
352+ relationBlockUid : rel . id ,
353+ } ) ;
354+ } catch ( error ) {
355+ console . error ( "Failed to create reified relation:" , error ) ;
356+ renderToast ( {
357+ id : "suggestions-create-block-error" ,
358+ content : "Failed to create relation" ,
359+ intent : "danger" ,
360+ timeout : 5000 ,
361361 } ) ;
362- } catch ( error ) {
363- console . error ( "Failed to create reified relation:" , error ) ;
362+ return ;
363+ }
364+ await notifySuggestiveModeAdopted ( {
365+ adoptionType : "relation" ,
366+ sourceTitle : tag ,
367+ destinationTitle : node . text ,
368+ } ) ;
369+ } else {
364370 renderToast ( {
365371 id : "suggestions-create-block-error" ,
366- content : "Failed to create relation" ,
372+ content : "Could not identify a relevant relation" ,
367373 intent : "danger" ,
368374 timeout : 5000 ,
369375 } ) ;
370- return ;
371376 }
372- await notifySuggestiveModeAdopted ( {
373- adoptionType : "relation" ,
374- sourceTitle : tag ,
375- destinationTitle : node . text ,
376- } ) ;
377377 } else {
378378 await createBlock ( {
379379 parentUid : blockUid ,
0 commit comments