viewer-components-react
viewer-components-react copied to clipboard
Tree widget: Add cache context provider
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.
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:
- Have a public
TreeWidgetContextProviderthat internally wraps its children with the mentioned cache context provider. - Have our
TreeWidgetComponentwrap the trees with the newTreeWidgetContextProvider. - Document
TreeWidgetContextProviderin README - when and why to use it.