eclipse-sirius / sirius-web

Sirius Web: open-source low-code platform to define custom web applications supporting your specific visual languages
https://eclipse.dev/sirius/sirius-web.html
Eclipse Public License 2.0
79 stars 52 forks source link

Expanding/collapsing a node in the Explorer re-renders the whole workbench #3595

Open pcdavid opened 4 months ago

pcdavid commented 4 months ago

This is particularly visible when a large diagram is opened.

  1. Open a project with two diagrams, one small (S) and one big (B).
  2. Open S, select a element in the explorer.
  3. Expand/collapse the element in the explorer, not changing the selection. The effect is immediate.
  4. Open B instead of S, and repeat step 3, expanding/collapsing the same element. It is now very slow.

There is no actual selection change, but since SelectionContextProvider's setSelection does not check that it calls setState with a new selection objet structurally equivalent but different in terms of identity. Now that the selection context is high in the component hierarchy, this re-renders the whole workbench, including the big diagram.

The solution is the same as in d995d6e79d41926f41290f0b4661a1ae118bc2b9: update the selection state if the key is new value is really structurally different from the previous one.

AxelRICHARD commented 4 months ago

This issue is reopened because the corresponding commit has been reverted by https://github.com/eclipse-sirius/sirius-web/pull/3646