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.
Hi there!
This is related to #44 and mostly intended to initiate a discussion about integers larger than
MAX_SAFE_INTEGER
.It is also the result of me trying to figure out why managing a single feature (from a vector source) on my Mapbox GL map sometimes affected multiple features.
The problem, as far as I can tell, is that there is no distinction between
32bit
and64bit
varint
. That means subtle bugs may (silently) be introduced when (de)serializing numbers aboveMAX_SAFE_INTEGER
(2^53 - 1
).In my case the features on my map are hexagons based on
Uber
sh3
hierarchical grid (represented usinguint64
ids, and generated using PostGIS'ST_AsMVT
). When setting feature state on some of the higher resolution hexagons, the equally check breaks and multiple cells are affected even though their ids are unique (in the protobuf).I can't see any way to solve this without introducing a breaking change that represents 64bit integers as either strings, number arrays or
BigInt
.This PR uses
BigInt
because it was the simplest, but as stated earlier I am mostly interested in your thoughts on the issue. My goal is to achieve support foruint64
ids Mapbox GL JS vector sources.