You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the master/details example, we already have the full contact object available in the master component.
When linking to the detail component, we pass the id then fetch back the contact.
My current project has a similar use case and I would like to optionally add exra data to the Link (e.g. a full contact) so I avoid a request when I already have needed data.
Any idea ?
The text was updated successfully, but these errors were encountered:
The store in that example keeps the data cached, so it doesn't make new server requests for data it already fetched.
I have found in ember, (which typically works like {{#link-to "user" userData}}) that devs think their user route works if you land there, but it doesn't if their model hook is broken so it only works when you start one route above (the route that gets the data).
In other words:
Land at /
Data is fetched
User clicks link that passes data in
Route renders perfectly, model hook ignored
Now consider:
Land at /users/123
Data has not fetched yet from the parent route
Model hook doesn't work
Route is broken.
In my experience this happens a lot in ember, so I designed this router to just pass the parameters and not data objects so that your code always runs the same way (instead of two code paths). It is the store's job to avoid server requests, not the incidental hierarchy of your components and their data.
ryanflorence
changed the title
pass init data when available and avoid a server request
pass init data to Link when available and avoid a server request
Jun 20, 2014
In the master/details example, we already have the full contact object available in the master component.
When linking to the detail component, we pass the id then fetch back the contact.
My current project has a similar use case and I would like to optionally add exra data to the Link (e.g. a full contact) so I avoid a request when I already have needed data.
Any idea ?
The text was updated successfully, but these errors were encountered: