@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
3
3
import { APIService , Configuration , WebService } from '../../../api/edulint' ;
4
4
import { environment } from '../../../environments/environment' ;
5
5
import { combineLatest , Observable , of } from 'rxjs' ;
6
- import { catchError , filter , map , mergeMap } from 'rxjs/operators' ;
6
+ import { catchError , filter , map , mergeMap , shareReplay , take } from 'rxjs/operators' ;
7
7
import { EdulintReport } from '../../models' ;
8
8
9
9
@Injectable ( {
@@ -31,13 +31,17 @@ export class EdulintService {
31
31
code += `\n# edulint: config=${ this . config } \n` ;
32
32
33
33
return this . linter . apiCodePost ( { code} ) . pipe (
34
+ take ( 1 ) ,
35
+ shareReplay ( 1 ) ,
34
36
catchError ( ( e ) => {
35
37
environment . logger . error ( '[EduLint] Code post error' , e ) ;
36
38
return of ( { hash : undefined } ) ;
37
39
} ) ,
38
40
filter ( ( response ) => response . hash !== undefined ) ,
39
41
map ( response => `${ response . hash } ` ) ,
40
42
mergeMap ( ( hash ) => combineLatest ( [ this . linter . analyzeUploaded ( this . version , hash ) , of ( hash ) ] ) ) ,
43
+ take ( 1 ) ,
44
+ shareReplay ( 1 ) ,
41
45
map ( ( [ problems , hash ] ) => ( {
42
46
problems,
43
47
editorUrl : `${ this . url } /editor/${ hash } `
0 commit comments