f5 / unovis

Modular data visualization framework for React, Angular, Svelte, Vue, and vanilla TypeScript or JavaScript
https://unovis.dev
Apache License 2.0
2.2k stars 43 forks source link

Containers: Don't re-append SVG defs if they didn't change #405

Closed rokotyan closed 3 months ago

rokotyan commented 3 months ago

Currently SVG defs are re-appended on each render and it causes flickering. This PR fixes it.

Before (icons are flickering)

https://github.com/f5/unovis/assets/755708/e38b42c0-7b0d-40cc-9d7b-302a911d0ba2

After (no flickering)

https://github.com/f5/unovis/assets/755708/7b309156-9aee-444d-bf2f-c7660d5f00a2

lee00678 commented 3 months ago

@rokotyan do you know under what circumstance the flickering occurs? But regardless I think not re-render on each render is a good idea.

rokotyan commented 3 months ago

@lee00678 On any event that triggers graph rendering, e.g. a prop change in React (a pretty common scenario)

lee00678 commented 3 months ago

@lee00678 On any event that triggers graph rendering, e.g. a prop change in React (a pretty common scenario)

Gotcha. I see it happen now. Thanks for the info.