Skip to content

Number cell with BigInt support #843

@lukasmasuch

Description

@lukasmasuch
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.

Activity

jassmith

jassmith commented on Dec 29, 2023

@jassmith
Contributor

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

lukasmasuch

lukasmasuch commented on Dec 29, 2023

@lukasmasuch
CollaboratorAuthor

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

jassmith

jassmith commented on Jan 2, 2024

@jassmith
Contributor

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

lukasmasuch

lukasmasuch commented on Jan 2, 2024

@lukasmasuch
CollaboratorAuthor

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

jassmith commented on Jan 2, 2024

@jassmith
Contributor

Oh very nice. Okay Im on board with this.

linked a pull request that will close this issue on Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:cellsRequests related to the cells packagepackage:coreRequests related to the core packagetype:enhancementRequests for enhancements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jassmith@lukasmasuch

      Issue actions

        Number cell with BigInt support · Issue #843 · glideapps/glide-data-grid