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

Bug: BigInt does not get toString()'d when rendered #20492

Closed
andyboyne opened this issue Dec 21, 2020 · 3 comments · Fixed by #24580
Closed

Bug: BigInt does not get toString()'d when rendered #20492

andyboyne opened this issue Dec 21, 2020 · 3 comments · Fixed by #24580
Labels
Component: DOM Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Feature Request

Comments

@andyboyne
Copy link

{1n}
should render 1. Instead it renders ''.

It looks like 'bigint' just needs adding here: https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ToStringValue.js#L26.

Happy to raise a PR or take guidance on a better approach.

React version: all

Steps To Reproduce

Link to code example: https://codepen.io/boyne/pen/vYXJWVr

The current behavior

Renders ""

The expected behavior

Renders 1

@andyboyne andyboyne added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Dec 21, 2020
@eps1lon eps1lon added Component: DOM Type: Bug Type: Feature Request and removed Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Dec 21, 2020
@eps1lon
Copy link
Collaborator

eps1lon commented Dec 22, 2020

Happy to raise a PR or take guidance on a better approach.

You've already identified a possible solution on the client. But I think the server might also need adjustment.

In any case, this feature needs some test. I believe you would need to add tests to:

  • packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js (for server side rendering)
  • packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js (for hydrating)
  • packages/react-dom/src/__tests__/ReactDOM-test.js (for client side rendering)

Though there might be some stress cases for using BigInt with the newly proposed Server Components since not all BigInts are serializeable.

You could start working on it and open a PR with your latest progress. But please be aware that I'm not not a maintainer and can't decide if your work is going to be accepted or not. However, I do believe that the work would be appreciated.

@eps1lon eps1lon added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Dec 22, 2020
@HSchmale16
Copy link

This also affects me too. Is there any word of resolution?

I can confirm that it is still happening with React 17.0.2.

Working on building a numerical simulation and would prefer not to have toString on all my outputs.

@Shu-Ji
Copy link

Shu-Ji commented May 18, 2022

The latest React-v18 affects me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: DOM Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Feature Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants