We need a way to cut off diffing. In V1 there was a clever trick that involved getting the location of a function type.
It does seem like a hack to me, but very clever! ^_^.
Unfortunately, we cannot directly port it to v2 due to new reconciler. For example it works with structs vs reference types.
So, we need a similar way to cut off diffing of a branch. Note that in that case diffing of a branch is going to be way slower than a few allocations, thus it is totally ok to use dynamic dispatch + heap allocated values there.
I would propose to store some data in ViewNode (seems like a good place for that) vs global weak map used in V1. That is how React and Elm do that (at least conceptually).
We need a way to cut off diffing. In V1 there was a clever trick that involved getting the location of a function type.
It does seem like a hack to me, but very clever! ^_^.
Unfortunately, we cannot directly port it to v2 due to new reconciler. For example it works with structs vs reference types.
So, we need a similar way to cut off diffing of a branch. Note that in that case diffing of a branch is going to be way slower than a few allocations, thus it is totally ok to use dynamic dispatch + heap allocated values there.
I would propose to store some data in ViewNode (seems like a good place for that) vs global weak map used in V1. That is how React and Elm do that (at least conceptually).