Skip to content

Bug: Large TypedArray props hang browser in dev mode in 19.2.X #36200

@jschlechtvjt

Description

@jschlechtvjt

Passing a large TypedArray, e.g. Float32Array(25000000), as a prop to a component, causes rendering to hang in development mode in React >= 19.2. Production mode is unaffected. Earlier versions of React (<= 19.1.5) are unaffected in both dev and prod modes.

Potentially related to #35126.

React version: >=19.2

Steps To Reproduce

Render the component React192TypedArrayPropIssue in the following code example:

import React from 'react';

function SlowToRenderInDevMode({array}: {array: Uint8Array}) {
  return (
    <>
      <div>{array.length}</div>
      <button>unclickable</button>    
    </>
  );
}

export function React192TypedArrayPropIssue() {
  // const [array, setArray] = React.useState<Float32Array>(new Float32Array());
  const [array, setArray] = React.useState<Uint8Array>(new Uint8Array());

  React.useEffect(() => {
    setArray(new Uint8Array(5000 * 5000));
  }, []);

  return (
    <SlowToRenderInDevMode array={array}/>
  )
}

The current behavior

For a Uint8Array or Float32Array of length of 25000000, the render takes > 10seconds and freezes the browser.
Non-typed arrays are unaffected by the issue.

The expected behavior

In production mode (or earlier versions of React <=19.1.5) render is immediate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions