Skip to content
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 errors caused by numeric IDs that are too big for JS numbers #1153

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

tjennison-work
Copy link
Collaborator

  • Numbers in JS are doubles by default. This generally works fine for numeric data but can cause truncation for IDs that use the entire space of an int64.
  • The JSON functions can't correctly handle the large numbers without some change to the format. The easiest is to send int64s as strings.
  • Those numbers are converted to BigInts to make them numeric but retain their precision. This requires using them throughout the code since our keys/ids are generally int64s.
  • BigInts don't follow the same coercion rules as numbers, so many places that previously just worked (e.g. data maps, JSX keys) no longer do. Convert data maps to actual Map objects and explicitly convert keys to strings.
  • The change to Maps exposes some clunkiness in the way TreeGrid data is handled. Sticking to a simple conversion for now but will consider other changes in a followup.

@tjennison-work tjennison-work force-pushed the push-mvynsprozqzz branch 3 times, most recently from e71832b to 0430e23 Compare January 31, 2025 16:24
* Numbers in JS are doubles by default. This generally works fine
  for numeric data but can cause truncation for IDs that use the
  entire space of an int64.
* The JSON functions can't correctly handle the large numbers
  without some change to the format. The easiest is to send int64s
  as strings.
* Those numbers are converted to BigInts to make them numeric but
  retain their precision. This requires using them throughout the
  code since our keys/ids are generally int64s.
* BigInts don't follow the same coercion rules as numbers, so many
  places that previously just worked (e.g. data maps, JSX keys) no
  longer do. Convert data maps to actual Map objects and
  explicitly convert keys to strings.
* The change to Maps exposes some clunkiness in the way TreeGrid
  data is handled. Sticking to a simple conversion for now but
  will consider other changes in a followup.
@tjennison-work tjennison-work merged commit aba7d10 into main Jan 31, 2025
8 checks passed
@tjennison-work tjennison-work deleted the push-mvynsprozqzz branch January 31, 2025 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants