@@ -148,17 +148,19 @@ export class VocabularyService {
148148 pagination : paginationOptions
149149 } ) ;
150150
151- // Use ORCID external source (try both orcid and orcidV2)
152- return this . externalSourceDataService . getExternalSourceEntries ( 'orcid' , searchOptions ) . pipe (
153- switchMap ( ( orcidResponse : RemoteData < PaginatedList < ExternalSourceEntry > > ) => {
154- if ( orcidResponse . hasSucceeded && orcidResponse . payload && orcidResponse . payload . page . length > 0 ) {
151+ // Use ORCID external source with proper completion handling
152+ return this . externalSourceDataService . getExternalSourceEntries ( 'orcid' , searchOptions , false , false ) . pipe (
153+ // Use the existing DSpace operator to ensure completion
154+ getFirstSucceededRemoteDataPayload ( ) ,
155+ switchMap ( ( paginatedList : PaginatedList < ExternalSourceEntry > ) => {
156+ if ( paginatedList && paginatedList . page . length > 0 ) {
155157 // Convert ExternalSourceEntry to VocabularyEntry
156- const vocabularyEntries : VocabularyEntry [ ] = orcidResponse . payload . page . map ( entry => {
158+ const vocabularyEntries : VocabularyEntry [ ] = paginatedList . page . map ( entry => {
157159 const vocabEntry = new VocabularyEntry ( ) ;
158160 // Display shows author name + ORCID for selection
159161 vocabEntry . display = `${ entry . display } (ORCID: ${ entry . id } )` ;
160- // Value should be just the author name (what goes in the main field)
161- vocabEntry . value = entry . display ;
162+ // Value should be just the author name (what goes in the main field)
163+ vocabEntry . value = entry . display ;
162164 // Authority is the ORCID ID (what goes in the authority field)
163165 vocabEntry . authority = entry . id ;
164166 vocabEntry . otherInformation = { orcid : entry . id } ;
@@ -173,8 +175,9 @@ export class VocabularyService {
173175 return createSuccessfulRemoteDataObject$ ( emptyList ) ;
174176 }
175177 } ) ,
176- catchError ( ( ) => {
177- // On error, return empty list
178+ catchError ( ( error ) => {
179+ console . warn ( 'ORCID lookup failed:' , error ) ;
180+ // Return empty list on error rather than falling back
178181 const emptyList = buildPaginatedList ( new PageInfo ( ) , [ ] ) ;
179182 return createSuccessfulRemoteDataObject$ ( emptyList ) ;
180183 } )
0 commit comments