File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,13 @@ import Route from '@ember/routing/route';
3
3
import { inject as service } from '@ember/service' ;
4
4
5
5
import * as Sentry from '@sentry/browser' ;
6
+ import { rawTimeout , task } from 'ember-concurrency' ;
6
7
7
8
export default class ApplicationRoute extends Route {
8
9
@service progress ;
9
10
@service router ;
10
11
@service session ;
12
+ @service playground ;
11
13
12
14
beforeModel ( ) {
13
15
this . router . on ( 'routeDidChange' , ( ) => {
@@ -24,10 +26,21 @@ export default class ApplicationRoute extends Route {
24
26
//
25
27
// eslint-disable-next-line ember-concurrency/no-perform-without-catch
26
28
this . session . loadUserTask . perform ( ) ;
29
+
30
+ // trigger the preload task, but don't wait for the task to finish.
31
+ this . preloadPlaygroundCratesTask . perform ( ) . catch ( ( ) => {
32
+ // ignore all errors since we're only preloading here
33
+ } ) ;
27
34
}
28
35
29
36
@action loading ( transition ) {
30
37
this . progress . handle ( transition ) ;
31
38
return true ;
32
39
}
40
+
41
+ @task ( function * ( ) {
42
+ yield rawTimeout ( 1000 ) ;
43
+ yield this . playground . loadCratesTask . perform ( ) ;
44
+ } )
45
+ preloadPlaygroundCratesTask ;
33
46
}
You can’t perform that action at this time.
0 commit comments