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 maximum call stack error for large combobox option groups #5976

Merged

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Jun 16, 2022

Summary

Fixes an issue that has come up twice in Kibana support. The issue is that the spread operation,

matchingOptions.push(...matchingOptionsForGroup);

was transpiled to

matchingOptions.push.apply(matchingOptions, matchingOptionsForGroup);

which overflowed the call stack size when matchingOptionsForGroup array was too large (see https://mathiasbynens.be/demo/javascript-argument-count). The fix is to use the concat method to merge the two arrays. Also had to update a second instance in matching_options.ts with the same change.

Checklist

- [ ] Checked in both light and dark modes

  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
    - [ ] Props have proper autodocs and playground toggles
    - [ ] Added documentation
    - [ ] Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
    - [ ] Updated the Figma library counterpart
  • A changelog entry exists and is marked appropriately

@chandlerprall chandlerprall requested a review from cee-chen June 16, 2022 17:01
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Looks good to me! And also TIL :)

Super appreciate the inline comment as well as the unit test for regression! 🎉

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5976/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Good find!

@chandlerprall chandlerprall merged commit bc24f11 into elastic:main Jun 16, 2022
@chandlerprall chandlerprall deleted the bug/combobox-thousands-of-options branch June 16, 2022 18: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.

4 participants