-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(table): unable to sort large numbers in strings #12052
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
fix(table): unable to sort large numbers in strings #12052
Conversation
src/lib/table/table-data-source.ts
Outdated
if (_isNumberValue(value)) { | ||
const numberValue = Number(value); | ||
|
||
// Numbers beyond `MAX_SAFE_INTEGER` can't be compared reliably so we leave them as strings. |
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.
Is there more explanation for why they aren't compared reliably as floating point numbers?
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.
I've added a link to MDN which has an explanation.
770ec44
to
f067ee9
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
Looks like
We could just hard-code the value (since it's always the same) with a comment explaining why. |
Fixes not being able to sort numbers, inside strings, that are greater than the `MAX_SAFE_INTEGER`. These changes treat these numbers as strings since JS can't compare them reliably. Fixes angular#12009.
f067ee9
to
ae5ca19
Compare
I seem to have the |
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. |
Fixes not being able to sort numbers, inside strings, that are greater than the
MAX_SAFE_INTEGER
. These changes treat these numbers as strings since JS can't compare them reliably.Fixes #12009.