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';
33import { inject as service } from '@ember/service' ;
44
55import * as Sentry from '@sentry/browser' ;
6+ import { rawTimeout , task } from 'ember-concurrency' ;
67
78export default class ApplicationRoute extends Route {
89 @service progress ;
910 @service router ;
1011 @service session ;
12+ @service playground ;
1113
1214 beforeModel ( ) {
1315 this . router . on ( 'routeDidChange' , ( ) => {
@@ -24,10 +26,21 @@ export default class ApplicationRoute extends Route {
2426 //
2527 // eslint-disable-next-line ember-concurrency/no-perform-without-catch
2628 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+ } ) ;
2734 }
2835
2936 @action loading ( transition ) {
3037 this . progress . handle ( transition ) ;
3138 return true ;
3239 }
40+
41+ @task ( function * ( ) {
42+ yield rawTimeout ( 1000 ) ;
43+ yield this . playground . loadCratesTask . perform ( ) ;
44+ } )
45+ preloadPlaygroundCratesTask ;
3346}
You can’t perform that action at this time.
0 commit comments