inveniosoftware / react-searchkit

React component library for interacting with a REST API.
https://inveniosoftware.github.io/react-searchkit/
MIT License
78 stars 40 forks source link

State selection when different options start with the same name #258

Closed psaiz closed 5 months ago

psaiz commented 8 months ago

Package version (if known): 2.0.0

Describe the bug

I have a checkbox with multiple options. If the name of one of the options is a subset of a different one, then, the selection does not work properly.

Steps to Reproduce

Look at the screenshot, where there are several options: 'Configuration', 'Configuration HLT'

  1. Click on 'Configuration HLT', and things work as expected (the checkbox gets selected)
  2. Click on 'Configuration', and the checkbox of 'Configuration HLT' gets unselected.

Expected behavior

After the second click, both 'Configuration' and 'Configuration HLT' should be selected.

This is probably related to this line, and the comparison with startswith.

Screenshots (if applicable)

Additional context

Screenshot 2023-11-02 at 16 16 11