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

Migrate from Select.options to Select.selectedOptions #6678

Merged
merged 3 commits into from Oct 1, 2021

Conversation

krnlde
Copy link
Contributor

@krnlde krnlde commented Sep 30, 2021

This gives a tiny performance boost and reduces code, since we safe an unnecessary Array.filter.

Move from `options` to `selectedOptions` to reduce code and safe one array traversal.

See https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/selectedOptions for more information.

Will not work in IE11!
Since we moved from `Select.options` to `Select.selectedOptions` we don't need to filter for selected options by ourselfs anymore.
@bluebill1049
Copy link
Member

looks like build failed, i will take a look at it today after work 👍

@bluebill1049 bluebill1049 changed the base branch from master to feature/selectOptions October 1, 2021 01:50
@bluebill1049 bluebill1049 merged commit 59f0272 into react-hook-form:feature/selectOptions Oct 1, 2021
bluebill1049 added a commit that referenced this pull request Oct 1, 2021
* Migrate from Select.options to Select.selectedOptions (#6678)

* Add selectedOptions as a performance improvement

Move from `options` to `selectedOptions` to reduce code and safe one array traversal.

See https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/selectedOptions for more information.

Will not work in IE11!

* Remove unnecessary .filter for selected options

Since we moved from `Select.options` to `Select.selectedOptions` we don't need to filter for selected options by ourselfs anymore.

Co-authored-by: Bill <bluebill1049@hotmail.com>

* fix type error

* update tests

* remove .only

Co-authored-by: Kai Dorschner <krnlde@users.noreply.github.com>
@krnlde
Copy link
Contributor Author

krnlde commented Oct 1, 2021

looks like build failed, i will take a look at it today after work 👍

Yes sorry, I didn't have time to setup the whole environment :D

@bluebill1049
Copy link
Member

haha all good buddy, thanks for the contribution 👍

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.

None yet

2 participants