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]: FilterableMutiselect "onMenuChange" triggering multiple times on render #18270

Open
2 tasks done
Tomahaawk opened this issue Dec 23, 2024 · 0 comments
Open
2 tasks done

Comments

@Tomahaawk
Copy link
Contributor

Package

@carbon/react

Browser

Chrome

Package version

1.72

React version

18.3

Description

After @carbon/react v1.65, onMenuChange started triggering multiple times on the first render. I have a state update that is based on the onMenuChage callback which is now causing my application to have an odd behavior.

Also, now I need to use a useCallback so the application doesn't start looping and crashes. This is also reproducible by just removing the useCallback from the function passed to onMenuChange.

I tracked it down to this bug fix: #16896

Previous behavior the onMenuChange callback was only triggered after the user interacted with the dropdown.

Reproduction/example

https://stackblitz.com/edit/github-ehxczfmb?file=src%2FApp.tsx

Steps to reproduce

  1. Start the application

expected result: count should only be updated after the menu open/closes
actual result: count state is updated after render

Downgrading @carbon/react to v1.65 will make it work as expected.

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

RPA

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ⏱ Backlog
Development

No branches or pull requests

2 participants