-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove sorting from splitByGroups #9
Conversation
lib/group.js
Outdated
// Returns { groups: [], ungrouped: {} } | ||
export function splitByGroups(entities) { | ||
export function splitByGroups(entities, sort = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this function simple and remove sorting the groups array completely.
Where it is needed, the ordering can be done by the code calling this.
Make sure to update the test too.
Shit, I just realized that this is not going to work either. See, now the groups are not ordered at all. Including not being ordered by the view. The problem is that in the polymer-side of things, we pass down an object of entities and then have it use this function to figure out what to do. However, objects in JavaScript are iterated over in random order instead of insertion order. |
So I guess that we can close this PR and solve this completely in polymer. Instead of passing down |
Closing this as it is no longer needed |
I think we should also merge this. There is no need to keep the sorting here since it is done outside. |
Good point. Can you move the sorting into the tests? There is no guarantee that this order is going to be always like this as it's based on |
Woohoo Thanks 🐬 |
This is needed for home-assistant/frontend#443
Should I bump the version and update the dependency version on home-assistent-polymer?