f5 / unovis

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

WIP fix resize observer bug #458

Open curran opened 1 month ago

curran commented 1 month ago

WIP towards #455

curran commented 1 month ago

Current status: uncovered the fact that multiple resize observers are set up on the same element.

image

It looks like the constructor is invoked twice for the exact same element.

This could be related to the resize observer error, since each instance of the class assumes that it is the only instance associated with the given element.

rokotyan commented 1 month ago

It looks like the constructor is invoked twice for the exact same element.

This is probably due to React rendering components twice in the dev StrictMode, which is a known behavior and usually not an issue — Unovis container components should disconnect the observer when destroyed.

curran commented 1 month ago

Ah yes, great point!

image

Confirmed - the resize observer gets removed on cleanup.

Maybe the error could be coming from somewhere else...

curran commented 1 month ago

https://github.com/user-attachments/assets/5fead0ce-6cd8-4e0d-935b-60f0de97ab1c

The error seems to trigger when the vertical scrollbar gets added or removed.

rokotyan commented 1 month ago

I was able to reproduce this problem after setting "Show scroll bars" to "Always" in the macOS settings.

image
rokotyan commented 1 month ago

463 should fix this