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

fix: update FilterableMultiSelect onMenuChange behavior #18606

Merged

Conversation

adamalston
Copy link
Contributor

Closes #18270

Updated FilterableMultiSelect's onMenuChange behavior.

Changelog

Changed

  • Updated FilterableMultiSelect's onMenuChange behavior.

Testing / Reviewing

yarn test packages/react/src/components/MultiSelect/__tests__/FilterableMultiSelect-test.js

Copy link

netlify bot commented Feb 16, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit fad487c
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/67b785cc950212000872bc8f
😎 Deploy Preview https://deploy-preview-18606--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 16, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit fad487c
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67b785cc12e5ae0008f33988
😎 Deploy Preview https://deploy-preview-18606--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 16, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fad487c
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/67b785cc05ade4000808a8ec
😎 Deploy Preview https://deploy-preview-18606--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Feb 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.92%. Comparing base (74e2cb7) to head (fad487c).
Report is 22 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18606   +/-   ##
=======================================
  Coverage   84.91%   84.92%           
=======================================
  Files         408      408           
  Lines       14551    14557    +6     
  Branches     4765     4772    +7     
=======================================
+ Hits        12356    12362    +6     
+ Misses       2033     2032    -1     
- Partials      162      163    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamalston adamalston marked this pull request as ready for review February 16, 2025 17:55
@adamalston adamalston requested review from a team as code owners February 16, 2025 17:55
@Gururajj77
Copy link
Contributor

Hey @adamalston , could you write more about what are the changes you did and how it affects the component's behaviour??

@Kritvi-bhatia17 Kritvi-bhatia17 requested review from a team and laurenmrice and removed request for a team February 17, 2025 07:03
@Gururajj77 Gururajj77 removed the request for review from laurenmrice February 17, 2025 07:03
@adamalston
Copy link
Contributor Author

adamalston commented Feb 17, 2025

I've updated the logic so that:

  • When the component is controlled (i.e., the open prop is provided), onMenuChange is called exactly once on mount (if open is true) and doesn't trigger again on re-renders with the same open value.
  • In uncontrolled mode, the callback isn't called on mount, but will be triggered when a user interacts with the component.

The tests reflect these scenarios.

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@adamalston
Copy link
Contributor Author

I see the security scan is failing. I guess it didn't like me merging main into the branch. Doesn't seem like something I should need to revert though.

Copy link
Member

@ariellalgilmore ariellalgilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ariellalgilmore ariellalgilmore added this pull request to the merge queue Feb 25, 2025
Merged via the queue into carbon-design-system:main with commit c2cc7de Feb 25, 2025
37 of 38 checks passed
@adamalston adamalston deleted the 18270-multi-select branch February 25, 2025 19:01
@carbon-automation
Copy link
Contributor

Hey there! v11.77.0 was just released that references this issue/PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: FilterableMutiselect "onMenuChange" triggering multiple times on render
4 participants