salt-ds icon indicating copy to clipboard operation
salt-ds copied to clipboard

ComboBox controlled causes TypeErrors with React 16

Open fernandoabel opened this issue 10 months ago • 1 comments

Package name(s)

Core (@salt-ds/core)

Package version(s)

1.24.0

Description

The ComboBox seems to be broken when used with React 16 (I haven't tested with React 18 as we need still to upgrade). Since we support React 16 (and need to for compatibility with UITK), this needs to be fixed.

(Note: reporting this on behalf of an internal consumer, so adding the "community" label)

Steps to reproduce

  1. Setup an app that uses React 16 and include some basic Controlled ComboBox code (the Custom filtering from our StoryBook. I've copied the code below for convenience)
  2. Type anything in the ComboBox to filter the displayed options.

The following runtime error will occur: × TypeError Cannot read properties of null (reading 'value') at eval (https://w3k8s5.csb.app/node_modules/ salt-ds/core/dist-es/combo-box/ComboBox.js:266:24 This screen is visible only in development. It will not appear if the app crashes in production. Open your browser’s developer console to further inspect this error. This error overlay is powered by react-error-overlayused increate-react-app.

Error reproduced in CodeSandBox: https://codesandbox.io/p/sandbox/checkboxgroup-reproduction-forked-w3k8s5

Expected behavior

You should be able to filter the available options in the ComboBox without crashing the app

Operating system

  • [ ] macOS
  • [X] Windows
  • [ ] Linux
  • [ ] iOS
  • [ ] Android

Browser

  • [X] Chrome
  • [ ] Safari
  • [ ] Firefox
  • [ ] Edge

Are you a JPMorgan Chase & Co. employee?

  • [X] I am an employee of JPMorgan Chase & Co.

fernandoabel avatar May 01 '24 09:05 fernandoabel

Happens around onChange, likely to do with event pool.

origami-z avatar May 01 '24 13:05 origami-z