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

Number cell with BigInt support #843

Open
LukasMasuch opened this issue Dec 29, 2023 · 5 comments · May be fixed by #853
Open

Number cell with BigInt support #843

LukasMasuch opened this issue Dec 29, 2023 · 5 comments · May be fixed by #853
Labels
package:cells Requests related to the cells package package:core Requests related to the core package type:enhancement Requests for enhancements or new features

Comments

@LukasMasuch
Copy link
Collaborator

The current version of the number cell only supports normal Numbers but not BigInt numbers (> 2^53). Two potential solutions would be to:

  1. Enable the native number-cell to handle BigInt values in addition to Number values.
  2. Add a dedicate big-int cell to the cells package.
@LukasMasuch LukasMasuch added the type:enhancement Requests for enhancements or new features label Dec 29, 2023
@jassmith
Copy link
Contributor

I think option 1 is the way to go if react number format supports it. Have you a usecase for bigint data?

@LukasMasuch
Copy link
Collaborator Author

LukasMasuch commented Dec 29, 2023

yeah, users have run into this a couple of times mostly related to columns that contain numerical IDs. And timestamps and time durations are sometimes represented in nanoseconds... which can easily overflow Number

@LukasMasuch LukasMasuch added package:core Requests related to the core package package:cells Requests related to the cells package labels Dec 30, 2023
@jassmith
Copy link
Contributor

jassmith commented Jan 2, 2024

It looks like to make this possible we would need to swap out the editor implementation. react-number-format does not support this.

@LukasMasuch
Copy link
Collaborator Author

LukasMasuch commented Jan 2, 2024

I think react-number-format should be fine with handling larger numbers. E.g. 9007199254740992 is the highest supported value for Number without losing precision. In this demo, if you go higher the floatValue will lose precision but the string value will show the correct number:

Screen.Recording.2024-01-02.at.17.00.54.mov

This means, that we would need to handle the value as a string for the react-number-format input field if the cell data is a bigint.

@jassmith
Copy link
Contributor

jassmith commented Jan 2, 2024

Oh very nice. Okay Im on board with this.

@LukasMasuch LukasMasuch linked a pull request Jan 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:cells Requests related to the cells package package:core Requests related to the core package type:enhancement Requests for enhancements or new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants