@@ -42,7 +42,6 @@ export class RecordIDEComponent implements OnInit {
42
42
currentPos : number
43
43
} ;
44
44
snakeActive : boolean = false ;
45
- firstVisit : boolean = true ;
46
45
vertical : boolean = true ;
47
46
48
47
@@ -102,16 +101,13 @@ export class RecordIDEComponent implements OnInit {
102
101
this . project$ = this . projectApolloService . getProjectById ( projectId ) ;
103
102
this . subscriptions$ . push ( this . project$ . subscribe ( ( project ) => {
104
103
this . project = project ;
105
- if ( this . firstVisit ) {
106
- this . runRecordIde ( ) ;
107
- this . firstVisit = false ;
108
- }
104
+ this . runRecordIde ( true ) ;
109
105
} ) ) ;
110
106
return this . project$ . pipe ( first ( ) ) ;
111
107
}
112
108
113
- runRecordIde ( ) {
114
- if ( this . code . indexOf ( "import easteregg" ) != - 1 ) {
109
+ runRecordIde ( firstVisit : boolean = false ) {
110
+ if ( ! firstVisit && this . code . indexOf ( "import easteregg" ) != - 1 ) {
115
111
this . snakeActive = true ;
116
112
} else {
117
113
this . loading = true ;
@@ -157,13 +153,13 @@ export class RecordIDEComponent implements OnInit {
157
153
nextRecord ( ) {
158
154
this . clearIde ( ) ;
159
155
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 ) ;
161
157
}
162
158
163
159
prevRecord ( ) {
164
160
this . clearIde ( ) ;
165
161
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 ) ;
167
163
}
168
164
169
165
}
0 commit comments