File tree 4 files changed +26
-23
lines changed
4 files changed +26
-23
lines changed Original file line number Diff line number Diff line change @@ -80,28 +80,20 @@ export class RecRecAuthorList extends LitElement {
80
80
//==========================================================================||
81
81
// Private Helpers ||
82
82
//==========================================================================||
83
- async updateAuthorDetails ( ) {
83
+ async updateAuthorDetails ( retry = 3 ) {
84
84
if ( this . authors . length === 0 ) {
85
85
this . authorDetails = [ ] ;
86
86
return ;
87
87
}
88
88
89
- let done = false ;
90
- let retry = 3 ;
91
-
92
- while ( ! done && retry > 0 ) {
93
- try {
94
- const data = await searchAuthorDetails (
95
- this . authors . map ( d => d . authorId )
96
- ) ;
97
- this . authorDetails = data ;
98
- done = true ;
99
- } catch ( e ) {
100
- await new Promise < void > ( resolve => {
101
- setTimeout ( resolve , 2000 ) ;
102
- } ) ;
103
- retry -= 1 ;
104
- }
89
+ try {
90
+ const data = await searchAuthorDetails ( this . authors . map ( d => d . authorId ) ) ;
91
+ this . authorDetails = data ;
92
+ } catch ( e ) {
93
+ await new Promise < void > ( resolve => {
94
+ setTimeout ( resolve , 2000 ) ;
95
+ } ) ;
96
+ await this . updateAuthorDetails ( retry - 1 ) ;
105
97
}
106
98
}
107
99
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ export class RecRecAuthorView extends LitElement {
64
64
//==========================================================================||
65
65
// Event Handlers ||
66
66
//==========================================================================||
67
- searchInput ( e : InputEvent , delay = 200 ) {
67
+ searchInput ( e : InputEvent , delay = 600 ) {
68
68
const target = e . currentTarget as HTMLInputElement ;
69
69
const query = target . value ;
70
70
Original file line number Diff line number Diff line change @@ -345,10 +345,22 @@ export class RecRecRecommenderView extends LitElement {
345
345
return awardMap ;
346
346
}
347
347
348
- async updateCitations ( ) {
349
- console . time ( 'Query citations' ) ;
350
- const paperCitations = await getPaperCitations ( [ ...this . selectedPaperIDs ] ) ;
351
- console . timeEnd ( 'Query citations' ) ;
348
+ async updateCitations ( retry = 3 ) {
349
+ let paperCitations : SemanticPaperCitationDetail [ ] = [ ] ;
350
+
351
+ try {
352
+ console . time ( 'Query citations' ) ;
353
+ paperCitations = await getPaperCitations ( [ ...this . selectedPaperIDs ] ) ;
354
+ console . timeEnd ( 'Query citations' ) ;
355
+ } catch ( e ) {
356
+ await new Promise < void > ( resolve =>
357
+ setTimeout ( ( ) => {
358
+ resolve ( ) ;
359
+ } , 1000 )
360
+ ) ;
361
+ await this . updateCitations ( retry - 1 ) ;
362
+ return ;
363
+ }
352
364
353
365
// Find and store collaborators
354
366
for ( const paper of this . papers ) {
Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ export default {
26
26
27
27
const newRequest = new Request ( request , {
28
28
headers : {
29
- ...request . headers ,
30
29
'x-api-key' : `${ env . SEMANTIC_API } ` ,
31
30
} ,
32
31
body : request . body ,
You can’t perform that action at this time.
0 commit comments