ListComponent to DetailComponent: Is this a valid/compliant technique?


#1

Here is my pseudocode:

  1. App.DS.RESTAdapter

  2. App.MyData {id, description, hobby, skills}

  3. IndexRoute: model : return store.find(‘mydata’); This however returns only {mydata: [{id1, description1}, {id2, description2}]}. Notice - it does not have hobby and skills returned.

  4. components/mydata-list #each a_mydata {{#mydata-detail action=showDetail a_mydata store}} {{a_mydata.hobby }} {{ a_mydata.skills}} {{/mydata-detail}}

  5. component/mydata-detail {{yield}}

  6. mydataDetailComponent model : undefined, actions : { showDetail : function(a_mydata, store) { a_mydata = store.find(‘mydata’, a_mydata.id); // this results in rest call -> /mydata/:id and gets complete record including hobby and skills } }

My interpretation: Since a_mydata is available in both mydata-list and mydata-detail, and is updated in a_mydata, the {{yield}} in mydata-detail is getting the updated value! i.e. it is showing hobby and skills that were not available in mydata-list. I am thinking this is because Javascript object - a_mydata - is by reference.

Question: Is this a valid design + future compliant design pattern?

Thanks, Sandeep