Why is router.transitionTo interrupted when switching to the same model twice?

If I get my ember data model from the store and go on a route with it

var model = App.Foo.find(1); router.transitionTo('foo', model); 

Going to the route below and I see console.log

 App.FooRoute = Ember.Route.extend({ redirect: function() { console.log("redirect ..."); this.transitionTo('bar'); } }); 

If I change the model again and go over, it will still log the console, and everything will work. But if I am on the same model 2 times in a row, the console log will never be. When I go through ember source (RC3), I don’t understand why in this case it will break.

Why does the transition fail in ember when I do this?

+4
source share
2 answers

I'm not sure what you are asking - can you provide the exact code for what you mean by “change model and transition again” and “do a search on one model twice in a row”?

Also ... the route is not "re-entered" if you are transitionTo already running route, although I'm not sure if this is even relevant here. Could you clarify what you are doing?

+1
source

My workaround is to call the repository method using the route button, which then emits my desired component. A little "hoarse" for my taste, but what works.

+1
source

Source: https://habr.com/ru/post/1479835/


All Articles