iTwin / viewer-components-react

Components built on iTwin.js for usability in an iTwin.js based Viewer.
MIT License
24 stars 34 forks source link

Tree widget: Tree load takes too much time when a lot of elements are selected with instance focus mode enabled #919

Closed grigasp closed 5 months ago

grigasp commented 5 months ago

http://localhost:3000/?iTwinId=b391ba44-add7-47a0-8375-f2889a3540e8&iModelId=ba504f88-a479-4156-9d81-658ee169588e

  1. Open stateless models tree
  2. Enable focus mode
  3. Fence-select all elements in the viewport

Result:

TreeWidget [models-tree-v2-reload] took 23443 ms
grigasp commented 5 months ago

This happens because we attempt to filter the hierarchy based on a very large number of instance keys. There's a similar situation if you try to filter a string that's contained in many node labels, e.g. "a".

IMO, the solution is to prohibit filtering the hierarchy by more than 100 number of instance keys.

grigasp commented 5 months ago

Related: https://github.com/iTwin/viewer-components-react/issues/908.