mercredi 31 janvier 2018

Ember loading state not triggered on transitionTo

If I use a transitionTo on a route with a slow model hook, the loading.hbs state never gets triggered (I have loading.hbs files at all of the levels -- cluster, cluster.schedule and cluster.schedule.preview_grid). I tried renaming the one at cluster.schedule preview_grid-loading.hbs with no luck.

On the transitionTo, there is no model or model id passed in, just the route:

viewPreviewGrid: function() { this.transitionTo('cluster.schedule.preview_grid'); },

I also have a loading action defined as follows:

loading(transition) {
    var controller = this.controller;
    if (!Ember.isNone(controller)) {
        this.controller.reset();
    }
    transition.promise.finally(function() {
        NProgress.done();
    });
}

During the transitionTo call the page just stays on the previous route until the promises in the model hook resolve, and then it transitions to the other route. If I refresh the page, the loading state gets triggered just fine. Is this a known behaviour for transitionTo?




Aucun commentaire:

Enregistrer un commentaire