primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.15k stars 4.54k forks source link

Add trackBy function to selectButton #8231

Open rafa-suagu opened 4 years ago

rafa-suagu commented 4 years ago

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports) If you need a plunkr showing the big amount of error caused by the trackBy absence I can do it.

Current behavior The selectors are repainting a lot of times when the value is an object, using the dataKey and optionLabel property. Angular can't check the equality properly and repaint the list completely.

This behaviour cause a very bad performance and also raise another errors for example no call the onClick or onChange function or not update the option selected.

Also you are not be able to add a pipe like slice on the input.

Expected behavior Add a trackBy function by default and input to customise it resolves all the errors.

Repainting behaviour: Single mode: Only two elements should be repainted on every selection. Multiple mode: Only one element should be repainted on every selection.

Minimal reproduction of the problem with instructions You can see the error using the dataKey and optionLabel when value is an object, in conjunction with slice pipe to show only 3 elements of options array.

What is the motivation / use case for changing the behavior? To have a good performance, follow the Angular recommendations and have a component that works properly on all the cases.

Please tell us about your environment: MAC OS X Mojave 10.14.6 WebStorm 2019.3 Yarn 1.19.1

mertsincan commented 1 year ago

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

rafa-suagu commented 1 year ago

@mertsincan I can't reopen this issue and we're continuing without trackBy on "selectButton". I think this situation it's happening on more components.