Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit 9df1c20

Browse files
authored
Fixes Bugs in the record ide (#36)
* runs record ide for next or prev record * pr comment
1 parent 8307625 commit 9df1c20

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/app/record-ide/components/record-ide.component.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export class RecordIDEComponent implements OnInit {
4242
currentPos: number
4343
};
4444
snakeActive: boolean = false;
45-
firstVisit: boolean = true;
4645
vertical: boolean = true;
4746

4847

@@ -102,16 +101,13 @@ export class RecordIDEComponent implements OnInit {
102101
this.project$ = this.projectApolloService.getProjectById(projectId);
103102
this.subscriptions$.push(this.project$.subscribe((project) => {
104103
this.project = project;
105-
if (this.firstVisit) {
106-
this.runRecordIde();
107-
this.firstVisit = false;
108-
}
104+
this.runRecordIde(true);
109105
}));
110106
return this.project$.pipe(first());
111107
}
112108

113-
runRecordIde() {
114-
if (this.code.indexOf("import easteregg") != -1) {
109+
runRecordIde(firstVisit: boolean = false) {
110+
if (!firstVisit && this.code.indexOf("import easteregg") != -1) {
115111
this.snakeActive = true;
116112
} else {
117113
this.loading = true;
@@ -157,13 +153,13 @@ export class RecordIDEComponent implements OnInit {
157153
nextRecord() {
158154
this.clearIde();
159155
this.router.navigate(["projects", this.project.id, "record-ide", this.session], { queryParams: { pos: Math.min(this.position + 1, this.sessionData.recordIds.length) } });
160-
this.firstVisit = true;
156+
setTimeout(() => this.runRecordIde(), 200);
161157
}
162158

163159
prevRecord() {
164160
this.clearIde();
165161
this.router.navigate(["projects", this.project.id, "record-ide", this.session], { queryParams: { pos: Math.max(this.position - 1, 1) } });
166-
this.firstVisit = true;
162+
setTimeout(() => this.runRecordIde(), 200);
167163
}
168164

169165
}

0 commit comments

Comments
 (0)