Dashboard data - Routable components "arrival"


Hello everyone!

So, I have an ember app and I am building a dashboard for the users of the application. My application fetches data from a Rails json-api API ( typical :slight_smile: ). So far so good.

The issue I have is that in the dashboard I have charts, tables with data etc which are not related with a specific model in my application. Which is the best way to fetch this data. I tried something like the following at first:

model(params) {
  let projects = this.get('store').query('project', {//params//}),
      leads = this.get('store').query('lead', {//params//});
  return {projects: projects, leads: leads};

But in certain occasions the queries might take a long time to run. At the moment I am doing an Ajax call to fetch all the data I need for my charts etc, and in certain components I fetch the data individually inside the component. I understand that this is not the “ember way”, but it was the best working solution I could come up with.

So my questions are the following:

  1. Which is the best way to fetch all the needed data for a dashboard ( especially when it is a lot of data ) ?
  2. How about asynchronous components - routable components? Are they coming in ember ?


In the ‘dashboard’ route of our app, the user get to pick and choose the widgets he wants to see. We could have cooked up a scheme to have the route rip through an unbounded array of unknown queries that are matched to a runtime component invocation. But instead we just punted and put the async call in the didInsertElemnt (iirc). It works well. Because one widgets data is unknown and unbound to another’s, we could (and do) sometimes pull the same data twice. But the nice part about each compoment-widget getting it’s own data is that it can handle it’s own pacifier and it will also render when it’s data is ready, regardless of the others.


Yeap, that’s how I did it also. For the same reasons.