Description
This is something I've thought about in regard to focus, hover and selection.
If you implement hover as a top level state value with the currently hovered root component as hoverID: component
and currently focused component as focusID: component
.
Now anything in between gets rerendered and can respond to those things changing. However, that also means that everything gets rerendered. Not just the previous and next path.
The ideal would be that you store the path to that component, or extract the path from internal state.
That way we can quickly rerender only the previous and next path, while still letting anything in between react to focus/hover changing.
Maybe this is more generally useful.
Selection is a bit special because it might need to rerender anything in between two paths but that can also be optimized similarly - by checking if any child node corresponds to a start and end path and anything between is selected or unselected.