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.
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
An option to use a feature property as ID for feature state #8987
An option to use a feature property as ID for feature state #8987
Changes from all commits
cc13e2d
e7f8b79
6c146ab
ad09b9d
bf12653
b7935e5
8271bd0
3da8aa0
645608c
8abdcd7
ce19214
71d135f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 think this incorrectly handles strings that can be converted to javascript numbers but not javascript integers:
'9007199254740993'
'1.2'
'Infinity'
It also looks like users of this function expect integers but this can return a float if given a float. Is that ok because it should never be given a float?
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.
Initially this was hashing all non-integer ids, but then I changed it because I thought there's no longer a need to have it limited to integer — those get saved in a Float64Array anyway, which supports decimals, values like
Infinity
, and values bigger thanMAX_SAFE_INTEGER
.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.
Oh, actually, in addition to the above, this function being exported is a leftover from earlier — how things get stored in the position map should be an internal detail so there won't be "users" of this. I'll remove the "export".
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.
Neither javascript numbers (which are 64 bit floats) or Float64Array can store integers > MAX_SAFE_INTEGER safely. Both
'9007199254740993'
and'9007199254740992'
will look like the same id to this implementation. This might seem unlikely but we ran into this with iD editor because osm uses sequential 64 integers as ids.Similar problems theoretically exist with decimals but seem less likely.
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.
Fair enough — updated to hash as a string in case a numeric id is more than
MAX_SAFE_INTEGER
.