viewer-components-react icon indicating copy to clipboard operation
viewer-components-react copied to clipboard

Tree widget: Add cache context provider

Open JonasDov opened this issue 4 months ago • 1 comments

Models, categories and classifications trees use similar cache implementations. They can be unified and shared across these different trees. This will not only reduce code duplication, but will also reduce load times when switching across trees. What should be done:

  • Add cache context provider. Context provider should provide the reusable cache (can be shared in models, categories and classifications trees);
  • If cache context is not provided, each tree should create the cache;
  • Log warning if cache provider is not present.

JonasDov avatar Aug 25 '25 09:08 JonasDov

I think it's important to note, that caches are internal and we don't want to make them public. To work around that, I think we should:

  1. Have a public TreeWidgetContextProvider that internally wraps its children with the mentioned cache context provider.
  2. Have our TreeWidgetComponent wrap the trees with the new TreeWidgetContextProvider.
  3. Document TreeWidgetContextProvider in README - when and why to use it.

grigasp avatar Aug 25 '25 10:08 grigasp