Using Ember I have a parent route with two nested child routes each child with a dynamic segment. The parent route does a calculation on its model to determine the “default” value of the dynamic segment for its child. Then the first child does the same for its own child route.
Everything is working well. However, what I’m seeing is that the adapters for the parent route and first (outer) child are being called twice. This causes a performance hit.
At each point where I do the calculation for the dynamic segment, I then do a “transitionTo” with the calculated value to load the child route. This is happening in the afterModel hook. I’m guessing that’s where the problem lives.
I’m able to prevent the second call to the adapter by checking the store to see if it’s already cached by that id. Is this what I should do or is this a hack required only because I’m misusing transitionTo in afterModel?
Aucun commentaire:
Enregistrer un commentaire