Add ability to sort models by record count#866
Merged
RobbieTheWagner merged 1 commit intoemberjs:masterfrom Sep 5, 2018
Merged
Add ability to sort models by record count#866RobbieTheWagner merged 1 commit intoemberjs:masterfrom
RobbieTheWagner merged 1 commit intoemberjs:masterfrom
Conversation
Member
RobbieTheWagner
left a comment
There was a problem hiding this comment.
This looks awesome @nlfurniss! Thanks for the PR 😄. I just had one question.
| application: controller(), | ||
| navWidth: 180, | ||
| sortProperties: ['name'], | ||
| sortByNameProp: Object.freeze(['name']), |
Member
There was a problem hiding this comment.
I'm curious what this Object.freeze is for?
Contributor
Author
There was a problem hiding this comment.
It’s a force of habit, more info available here.
But I guess that since this is a controller and not a component, the worry about leaking state/memory is less pronounced.
Member
There was a problem hiding this comment.
I typically do like the link you posted says and do like this.foo = [] in init. Should we do that here?
Contributor
Author
There was a problem hiding this comment.
Sure I can make those changes. There prob should be some standardize, see Ember.sort docs using Object.Freeze
c72a282 to
53fc4de
Compare
RobbieTheWagner
approved these changes
Sep 5, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It would be nice to be able to sort models by their record count as well as alphabetically (current option).
This PR
Adds ability to sort models by record count
Adds test for new sort functionality
DRYs up the code to get, set, and remove model sorting keys from Storage
Feature in action