diff --git a/src/app/components/tasks/task-module/task-module-programming/task-module-programming.component.ts b/src/app/components/tasks/task-module/task-module-programming/task-module-programming.component.ts index cab8290..6b80607 100644 --- a/src/app/components/tasks/task-module/task-module-programming/task-module-programming.component.ts +++ b/src/app/components/tasks/task-module/task-module-programming/task-module-programming.component.ts @@ -96,7 +96,8 @@ export class TaskModuleProgrammingComponent implements OnInit, OnDestroy { if (result.result === 'ok') { this.lintCode(); } - }) + }), + shareReplay(1), ); (this.codeRun$ = this.codeRunResult$.pipe(mapTo(undefined))).subscribe(() => { this.codeRun$ = null; diff --git a/src/app/services/tasks/edulint.service.ts b/src/app/services/tasks/edulint.service.ts index 4747c82..f7936a4 100644 --- a/src/app/services/tasks/edulint.service.ts +++ b/src/app/services/tasks/edulint.service.ts @@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { APIService, Configuration, WebService } from '../../../api/edulint'; import { environment } from '../../../environments/environment'; import { combineLatest, Observable, of } from 'rxjs'; -import { catchError, filter, map, mergeMap } from 'rxjs/operators'; +import {catchError, filter, map, mergeMap, shareReplay, take} from 'rxjs/operators'; import { EdulintReport } from '../../models'; @Injectable({ @@ -31,6 +31,8 @@ export class EdulintService { code += `\n# edulint: config=${this.config}\n`; return this.linter.apiCodePost({code}).pipe( + take(1), + shareReplay(1), catchError((e) => { environment.logger.error('[EduLint] Code post error', e); return of({hash: undefined}); @@ -38,6 +40,8 @@ export class EdulintService { filter((response) => response.hash !== undefined), map(response => `${response.hash}`), mergeMap((hash) => combineLatest([this.linter.analyzeUploaded(this.version, hash), of(hash)])), + take(1), + shareReplay(1), map(([problems, hash]) => ({ problems, editorUrl: `${this.url}/editor/${hash}`