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(module:tree): tree select search slow in virtual mode #7385

Conversation

jpoyard
Copy link
Contributor

@jpoyard jpoyard commented Apr 25, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[X] Application (the showcase website) / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #5873

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

For nz-tree component
when nzVirtualHeight is defined and nzHideUnMatched=true
then we should remove node with canHide=true from nzFlattenNodes
In showcase website, for tree select component, i put nzHideUnMatched=true for virtual scroll sample

@zorro-bot
Copy link

zorro-bot bot commented Apr 25, 2022

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Apr 25, 2022

Codecov Report

Merging #7385 (ffb9474) into master (ea1138b) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #7385      +/-   ##
==========================================
+ Coverage   91.74%   91.76%   +0.01%     
==========================================
  Files         502      502              
  Lines       16700    16702       +2     
  Branches     2604     2605       +1     
==========================================
+ Hits        15321    15326       +5     
+ Misses       1048     1046       -2     
+ Partials      331      330       -1     
Impacted Files Coverage Δ
components/tree/tree.component.ts 94.41% <100.00%> (+0.06%) ⬆️
components/tabs/tab-nav-bar.component.ts 87.94% <0.00%> (+0.70%) ⬆️
components/core/util/text-measure.ts 92.98% <0.00%> (+0.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea1138b...ffb9474. Read the comment docs.

@jpoyard jpoyard force-pushed the fix/tree-select-search-slow-in-virtual-mode branch from a11e5c5 to 9b47830 Compare April 25, 2022 08:59
@Dylan0405
Copy link

This question bothered me for a long time since version 11. I solved it by this way temporarily #6426 (comment) . But when I upgraded to version 13, I just cannot find the same file and it didnt work fine anymore. I really hope this fix can be released as soon as possilble.

@whittssg
Copy link

whittssg commented Jun 30, 2022

This question bothered me for a long time since version 11. I solved it by this way temporarily #6426 (comment) . But when I upgraded to version 13, I just cannot find the same file and it didnt work fine anymore. I really hope this fix can be released as soon as possilble.

I just updated to v13 and cant find the files either to change this, i tried updating the mjs files but the changes dont reflect. I am guessing the library doesnt use the angular compatibility compiler anymore. Anyone know how to modify this without forking it? @Dylan0405 did you find away around it? Thanks

@Dylan0405
Copy link

@whittssg Not really. I also changed the codes both in file 'node_modules\ng-zorro-antd\fesm2015\ng-zorro-antd-tree.mjs' and 'node_modules\ng-zorro-antd\fesm2020\ng-zorro-antd-tree.mjs' as metioned before. It works if part of my build config in angular.json is
{"buildOptimizer": true, "optimization": true, "vendorChunk": false, "extractLicenses": true, "sourceMap": false, "namedChunks": false}
,but if the config is like follows:
{ "buildOptimizer": false, "optimization": false, "vendorChunk": true, "extractLicenses": false, "sourceMap": true, "namedChunks": true } then it won't work well. I don't know which field leads to the differences.

@whittssg
Copy link

whittssg commented Jul 4, 2022

@jpoyard
I think there might be a small bug in this PR.
If you go to the preview and scroll down to the virtual scroll demo, type a few characters and then delete them you end up with a blank list. It should revert to the full list once there are no characters in the search box (well it did before).

Maybe adding && this.nzSearchValue after this.nzHideUnMatched would work

Thanks

@whittssg
Copy link

whittssg commented Jul 4, 2022

@whittssg Not really. I also changed the codes both in file 'node_modules\ng-zorro-antd\fesm2015\ng-zorro-antd-tree.mjs' and 'node_modules\ng-zorro-antd\fesm2020\ng-zorro-antd-tree.mjs' as metioned before. It works if part of my build config in angular.json is {"buildOptimizer": true, "optimization": true, "vendorChunk": false, "extractLicenses": true, "sourceMap": false, "namedChunks": false} ,but if the config is like follows: { "buildOptimizer": false, "optimization": false, "vendorChunk": true, "extractLicenses": false, "sourceMap": true, "namedChunks": true } then it won't work well. I don't know which field leads to the differences.

I believe its just the new cache in angular 13.. delete the cache folder under .angular and it should pick up the changes

@jpoyard jpoyard force-pushed the fix/tree-select-search-slow-in-virtual-mode branch from 13e6ff1 to ffb9474 Compare July 5, 2022 05:46
@jpoyard
Copy link
Contributor Author

jpoyard commented Jul 5, 2022

@jpoyard I think there might be a small bug in this PR. If you go to the preview and scroll down to the virtual scroll demo, type a few characters and then delete them you end up with a blank list. It should revert to the full list once there are no characters in the search box (well it did before).

Maybe adding && this.nzSearchValue after this.nzHideUnMatched would work

Thanks

@whittssg, i added && this.nzSearchValue?.lengt > 0

@whittssg
Copy link

Has this been merged yet? Thanks

@Dylan0405
Copy link

@whittssg 这个好像还没合并,朋友,你找到其他解决方案没呢?

Has this been merged yet? Thanks

Copy link
Member

@simplejason simplejason left a comment

Choose a reason for hiding this comment

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

LGTM

@simplejason simplejason merged commit 21208f0 into NG-ZORRO:master Dec 11, 2022
@pr-triage pr-triage bot added the PR: merged label Dec 11, 2022
chenc041 pushed a commit to chenc041/ng-zorro-antd that referenced this pull request Dec 14, 2022
)

* fix(module:tree): tree select search slow in virtual mode

* fix(module:tree): tree select search slow in virtual mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants