-
Notifications
You must be signed in to change notification settings - Fork 26.3k
feat(common): disable keyvalue sorting using null compareFn #57487
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
Conversation
75488e5
to
6352cd2
Compare
Gentle ping @pkozlowski-opensource |
Closing and re-opening since a few CI jobs are missing here (Edit: turned out public API failed) |
6352cd2
to
3398a93
Compare
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.
LGTM
Reviewed-for: public-api
Reviewed-for: fw-common
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.
reviewed-for: public-api
The keyvalue pipe sorts the entries of the input by key. This has been the subject of debate in the past (angular#42490). The core of the discussions is that it is often desirable (and perhaps expected) that they natural ordering of the input is respected. There are at least two workarounds to restore natural ordering, such as a `compareFn` that simply returns `1` or a custom pipe. However, both of these require code for pipe consumers to maintain or copy around to many places. Allowing `null` as `compareFn` and treating it as "natural order" is fairly simple to understand, backward compatible and was suggested a few times on angular#42490 where it seemed to be received well. Using `null` is also possible in templates without any component code changes.
3398a93
to
20fbd79
Compare
I tried rebasing here since running EDIT: Or maybe it did add some updates without me noticing... |
@sbarfurth — I think @JeanMeche pushed to your PR to take care of it, so that's why there is no diff 😄 All good now. |
@sbarfurth I did it for you, we're good to go. The PR is in the merge queue ! |
Ah sorry about that, missed the push. Thanks! |
This PR was merged into the repository by commit 13c1306. The changes were merged into the following branches: main |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The keyvalue pipe sorts the entries of the input by key. This has been the subject of debate in the past (#42490). The core of the discussions is that it is often desirable (and perhaps expected) that they natural ordering of the input is respected. There are at least two workarounds to restore natural ordering, such as a
compareFn
that simply returns1
or a custom pipe. However, both of these require code for pipe consumers to maintain or copy around to many places.What is the new behavior?
Allowing
null
ascompareFn
and treating it as "natural order" is fairly simple to understand, backward compatible and was suggested a few times on #42490 where it seemed to be received well. Usingnull
is also possible in templates without any component code changes.Does this PR introduce a breaking change?
Other information
n/a