You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing one cell, or inserting/deleting a row/column, currently requires completely rerendering the DOM via renderSVGDOM. Given that it's already a method of Drawing, it could cache the last version of symbols along with pointers to corresponding DOM objects and, if present (so rerendering the same drawing), look for optimizations to avoid hitting the DOM (if use links to the same object and has same x and y coordinates, do nothing). Simple version is to just check attributes and change only when needed. For bonus points, look at neighboring cells and optimize the case of shifting.
A lot of this can probably be done via Preact's render, possibly applied to each cell individually. (In particular, we may want to provide an API for rendering individual symbols as part of an entire diagram.) We'd need to keep track of the previous VDOM and let it do the diff. And we'd need to generate VDOM if the mapping returns a raw string.
We could also potentially avoid calling dynamic symbols in some cases, by detecting what neighbors they depend on, and only calling if that changes. (But this would prevent side effects...) See #80
I'm also not sure whether this should be an automatic optimization within Drawing or a specific Render instance that tracks the rendered symbols. (Currently this is all mushed together into Drawing. Maybe that's OK?)
The text was updated successfully, but these errors were encountered:
Changing one cell, or inserting/deleting a row/column, currently requires completely rerendering the DOM via
renderSVGDOM
. Given that it's already a method ofDrawing
, it could cache the last version ofsymbols
along with pointers to corresponding DOM objects and, if present (so rerendering the same drawing), look for optimizations to avoid hitting the DOM (ifuse
links to the same object and has samex
andy
coordinates, do nothing). Simple version is to just check attributes and change only when needed. For bonus points, look at neighboring cells and optimize the case of shifting.A lot of this can probably be done via Preact's
render
, possibly applied to each cell individually. (In particular, we may want to provide an API for rendering individual symbols as part of an entire diagram.) We'd need to keep track of the previous VDOM and let it do the diff. And we'd need to generate VDOM if the mapping returns a raw string.We could also potentially avoid calling dynamic symbols in some cases, by detecting what neighbors they depend on, and only calling if that changes. (But this would prevent side effects...) See #80
I'm also not sure whether this should be an automatic optimization within
Drawing
or a specificRender
instance that tracks the rendered symbols. (Currently this is all mushed together intoDrawing
. Maybe that's OK?)The text was updated successfully, but these errors were encountered: