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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(module: select): multiple fixes and optimizations #1087

Merged
merged 3 commits into from
Feb 4, 2021

Conversation

anddrzejb
Copy link
Member

@anddrzejb anddrzejb commented Feb 4, 2021

馃 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

馃敆 Related issue link

#257
#594
#662
#877
#878
#1065
and a number of other issues discovered during fixing.

馃挕 Background and solution

I started fixing the Select component because I wanted to fix searchable multiple choice and tags + tokenization. This is fixed now, but there are a lot of changes. There is a Hashset structure that stores all selectable items. I noticed this structure was being traversed very often in multiple different methods. Often the algorithm time complexity for a method was O(2n), O(3n), O(n*n). I decided to introduce new variables to store the items for different scenarios and different parts of the component. I managed to reduce the complexity to mostly O(n) or even O(1). In several places I moved to foreach loop instead of linq loops, just to cover more ground in single loop instead of calling linq 2 or 3 times.
There is still room for optimization. What needs to be done is a very careful tracking of [Parameter] properties to see which of them are causing unnecessary component re-rendering.

馃摑 Changelog

Language Changelog
馃嚭馃嚫 English removed AllowCustomTags and OnCreateCustomTag
added PrefixIcon
馃嚚馃嚦 Chinese

鈽戯笍 Self Check before Merge

鈿狅笍 Please check all items below before review. 鈿狅笍

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

Copy link
Member

@ElderJames ElderJames left a comment

Choose a reason for hiding this comment

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

Awesome! It works well.

@ElderJames ElderJames merged commit 6a526c0 into ant-design-blazor:master Feb 4, 2021
@anddrzejb anddrzejb deleted the selectFixes branch February 9, 2021 18:23
ElderJames pushed a commit that referenced this pull request Apr 23, 2022
* fix(module:select): multiple select & tags & tokenization fix

performance optimizations
add PrefixIcon
keep focus on selected item

* fix(module:select): on clear button make first active

* docs(module:select): reflect changes
ElderJames pushed a commit that referenced this pull request Apr 30, 2022
* fix(module:select): multiple select & tags & tokenization fix

performance optimizations
add PrefixIcon
keep focus on selected item

* fix(module:select): on clear button make first active

* docs(module:select): reflect changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment