@@ -35,6 +35,7 @@ export const OntologyRecordType = types
3535 } )
3636 . volatile ( ( _self ) => ( {
3737 dataStore : undefined as undefined | OntologyStore ,
38+ startedEquivalentTypeRequests : new Set < string > ( ) ,
3839 } ) )
3940 . actions ( ( self ) => ( {
4041 /** does nothing, just used to access the model to force its lifecycle hooks to run */
@@ -66,6 +67,10 @@ export const OntologyRecordType = types
6667 if ( ! self . dataStore ) {
6768 return
6869 }
70+ if ( self . startedEquivalentTypeRequests . has ( type ) ) {
71+ return
72+ }
73+ self . startedEquivalentTypeRequests . add ( type )
6974 const terms = ( yield self . dataStore . getTermsWithLabelOrSynonym (
7075 type ,
7176 ) ) as unknown as OntologyTerm [ ]
@@ -75,6 +80,23 @@ export const OntologyRecordType = types
7580 self . setEquivalentTypes ( type , equivalents )
7681 } ) ,
7782 } ) )
83+ . actions ( ( self ) => ( {
84+ afterCreate ( ) {
85+ autorun ( ( reaction ) => {
86+ if ( ! self . dataStore ) {
87+ return
88+ }
89+ void self . loadEquivalentTypes ( 'gene' )
90+ void self . loadEquivalentTypes ( 'transcript' )
91+ void self . loadEquivalentTypes ( 'CDS' )
92+ void self . loadEquivalentTypes ( 'mRNA' )
93+ reaction . dispose ( )
94+ } )
95+ } ,
96+ setEquivalentTypes ( type : string , equivalentTypes : string [ ] ) {
97+ self . equivalentTypes . set ( type , equivalentTypes )
98+ } ,
99+ } ) )
78100 . views ( ( self ) => ( {
79101 isTypeOf ( queryType : string , typeOf : string ) : boolean {
80102 if ( queryType === typeOf ) {
0 commit comments