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(MenuItemSelectable): remove duplicate onChange #17967

Conversation

AlanGreene
Copy link
Contributor

@AlanGreene AlanGreene commented Nov 5, 2024

Closes #17968

This is the same issue and fix that was previously addressed for MenuItemRadioGroup in #17736.

Also added a test to cover this case, including checking the value passed to the onChange prop as the redundant onChange being removed here was passing the SyntheticEvent instead of the expected boolean.

Changelog

Changed

  • fixed the MenuItemSelectable component to ensure onChange is only called once

Testing / Reviewing

Unit test added to cover the expected behaviour.

@AlanGreene AlanGreene requested a review from a team as a code owner November 5, 2024 12:45
Copy link

netlify bot commented Nov 5, 2024

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

Name Link
🔨 Latest commit 97902f5
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/672e53df94556b0007ea7e86
😎 Deploy Preview https://deploy-preview-17967--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 Nov 5, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 97902f5
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/672e53df9ca60e000890a98a
😎 Deploy Preview https://deploy-preview-17967--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 Nov 5, 2024

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit 97902f5
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/672e53df6011c40008d9b447
😎 Deploy Preview https://deploy-preview-17967--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 Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.82%. Comparing base (d70431f) to head (97902f5).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17967      +/-   ##
==========================================
+ Coverage   81.80%   81.82%   +0.02%     
==========================================
  Files         404      404              
  Lines       14088    14086       -2     
  Branches     4409     4379      -30     
==========================================
+ Hits        11524    11526       +2     
+ Misses       2401     2397       -4     
  Partials      163      163              

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

This is the same issue and fix that was previously addressed for
`MenuItemRadioGroup` in carbon-design-system#17736.

Also added a test to cover this case, including checking the value
passed to the `onChange` prop as the redundant `onChange` being
removed here was passing the SyntheticEvent instead of the expected
boolean.
@AlanGreene AlanGreene force-pushed the menuitemselectable_duplicate_onChange branch from e6f8f77 to 2f8173e Compare November 5, 2024 18:48
Copy link
Contributor

@guidari guidari left a comment

Choose a reason for hiding this comment

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

Thanks for doing that! LGTM

@annawen1 annawen1 added this pull request to the merge queue Nov 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 8, 2024
@AlanGreene
Copy link
Contributor Author

Hi folks, is there anything else needed to get this merged? Looks like all checks are passing.

@annawen1 annawen1 added this pull request to the merge queue Nov 11, 2024
@annawen1
Copy link
Member

Hi folks, is there anything else needed to get this merged? Looks like all checks are passing.

Looks like it's good to go! Added to the merge queue

Merged via the queue into carbon-design-system:main with commit 664408d Nov 11, 2024
40 checks passed
@AlanGreene AlanGreene deleted the menuitemselectable_duplicate_onChange branch November 11, 2024 15:15
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]: MenuItemSelectable's onChange prop is called twice
4 participants