boardee
boardee copied to clipboard
Dashboard graph sorting
The graphs collection on a dashboard is not a cursor right now.
To be able to use a Graphs cursor, each graph should store it's position in a dashboard:
{
"dashboardPositions": {
"someDashboardId": "4"
}
}
That way the query on a dashboard would be something like:
Graphs.find({_id: {$in: graphsIds}}, {sort: {"dashboardPositions." + dashboardId: 1}})
The issue with the current sorting is that when a graphs is modified, meteor will refresh the DOM for all the graphs. With the suggested sorting, meteor would update only 1 graphs on the dashboard (would avoid reloading all the svgs)