cengage / react-magma

https://react-magma.cengage.com
MIT License
21 stars 12 forks source link

Checkbox performance slows significantly at scale #1020

Open katieweinstein opened 1 year ago

katieweinstein commented 1 year ago

Describe the bug The Checkbox component significantly slows performance & rendering time at scale (2000+ checkboxes) and slows functionality, like checking or unchecking a box. A difference of 4.69 native vs 10.02 React Magma was observed.

To Reproduce Steps to reproduce the behavior:

  1. Add the following code to the Checkbox storybook component:
    export const Lots = args => {
    function getCheckboxes() {
    const boxes = [];
    for (let i = 0; i < args.numberRows; i++) {
      boxes.push(
        <Checkbox key={i} checked labelText="Checked checkbox" />
      );
    }
    return boxes;
    }
    return <>{getCheckboxes()}</>;
    };
    Lots.args = {
    numberRows: 2000,
    };
  2. Open Storybook and Chrome devtools Performance tab.
  3. Record the rendering time.
  4. Change the Checkbox component to <input type="checkbox" />
  5. Rerecord the rendering time, note the difference.

Expected behavior Checkbox should not slow rendering this dramatically at scale.

Screenshots React Magma Checkbox image

Native checkbox input image

Desktop (please complete the following information):

Smartphone (please complete the following information): N/A

silvalaura commented 1 week ago

We should investigate virtualization for our checkboxes

silvalaura commented 5 days ago

After React 18 upgrade