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(menu): add if statement for missing slots #3717

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

najikahalsema
Copy link
Collaborator

Description

If the MenuItem's children don't have a contentSlot or iconSlot, we shouldn't do the work in get itemChildren(), because it's throwing an error when trying to map assignedElements for something that is null.

Related issue(s)

fixes #3626 (hopefully)

Motivation and context

Erroring in webcomponents.dev (example)

How has this been tested?

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@github-actions
Copy link

Tachometer results

Chrome

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 639 kB 303.62ms - 311.31ms - unsure 🔍
-1% - +2%
-1.65ms - +7.42ms
branch 625 kB 302.17ms - 306.98ms unsure 🔍
-2% - +1%
-7.42ms - +1.65ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 461 kB 450.70ms - 458.37ms - slower ❌
2% - 4%
6.92ms - 17.04ms
branch 448 kB 439.26ms - 445.86ms faster ✔
2% - 4%
6.92ms - 17.04ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 505 kB 990.15ms - 1011.95ms - unsure 🔍
-1% - +2%
-13.74ms - +16.20ms
branch 491 kB 989.56ms - 1010.08ms unsure 🔍
-2% - +1%
-16.20ms - +13.74ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 710 kB 1902.65ms - 1906.82ms - unsure 🔍
-0% - +0%
-4.51ms - +1.62ms
branch 696 kB 1903.93ms - 1908.43ms unsure 🔍
-0% - +0%
-1.62ms - +4.51ms
-
Firefox

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 639 kB 545.13ms - 579.59ms - unsure 🔍
-4% - +4%
-23.91ms - +21.23ms
branch 625 kB 549.12ms - 578.28ms unsure 🔍
-4% - +4%
-21.23ms - +23.91ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 461 kB 763.24ms - 814.04ms - unsure 🔍
-7% - +3%
-59.41ms - +20.93ms
branch 448 kB 776.76ms - 839.00ms unsure 🔍
-3% - +8%
-20.93ms - +59.41ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 505 kB 1424.61ms - 1482.39ms - unsure 🔍
-3% - +3%
-39.11ms - +36.43ms
branch 491 kB 1430.52ms - 1479.16ms unsure 🔍
-3% - +3%
-36.43ms - +39.11ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 710 kB 1640.14ms - 1660.78ms - unsure 🔍
-1% - +1%
-13.38ms - +15.90ms
branch 696 kB 1638.82ms - 1659.58ms unsure 🔍
-1% - +1%
-15.90ms - +13.38ms
-

Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

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

Thanks!

@Westbrook Westbrook merged commit c045822 into main Oct 11, 2023
@Westbrook Westbrook deleted the halsema/menu-item-children branch October 11, 2023 21:25
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]: Accessing value of sp-menu-item before render throws an error
2 participants