should __componentCache be global?
maparent opened this issue · 0 comments
maparent commented
In this line, we see that recursive component creation passes the ancestor down in the parent variable.
apprun/src/createComponent.tsx
Line 36 in 2be47e2
(vs
vdom.children = vdom.children.map(child => createComponent(child, vdom, _idx));
)This means that, in this line:
apprun/src/createComponent.tsx
Line 10 in 2be47e2
we're using the ancestor's cache if rendering the ancestor, and the parent's cache if rendering the parent. I have observed cache miss and recreation of components for that reason. (sometimes with missing sub-components, but that last part could be a problem on my side.)
I tried using vdom and ran into other issues with missing elements. I'm also not sure about the intent here.
The issue with a global cache might be ID collision; a local cache would fail on a drag and drop, but that's a lesser concern.
Either way, I think it would be good to make sure it is used consistently.