This.render inside beforeModel


#1

Is it expected that you can’t call this.render inside beforeModel? I get

Error while processing route: checkout.people-search Cannot read property 'push' of undefined TypeError: Cannot read property 'push' of undefined
    at Class.render (http://localhost:4200/assets/vendor.js:47429:24)
    at Class.beforeModel (http://localhost:4200/engines-dist/checkout/assets/engine.js:1790:14)

this.connections is undefined, and isn’t initialized until the activate hook.


#2

Not sure but as far as I remember calling this.render manually is already considered a not-too-good practice, isn’t it? What is your use case?


#3

My use case is showing a loading template right before redirecting to an external site. I don’t want a history entry or the URL to change so the back button skips the loading template.


#4

Exactly.

I’d say that you should use this.replaceWith and allow it to render normally…


#5

Looks like intermediateTransitionTo is what I wanted. It renders a route without adding a history entry or updating the URL.


#6

It’s cleat what it does, but just curious: it can’t cancel all current XHR requests. If it brakes the cycle, what will happen to your previous XHR requests that should return same models (and they probably has to be unloaded first)?