Closed kometenstaub closed 2 years ago
Technical analysis:
https://github.com/phibr0/obsidian-charts/blob/10a294f252e8f0eb7173d165f201969a725c57cb/src/chartRenderer.ts#L300 This is likely unnecessary because you're unloading anyway, but what happens is that this might have gotten triggered at a bad time and sets the height to 0.
Even for a reload, this shouldn't really be needed since the height was never set in the first place so it would have just fit the contents inside automatically.
I added that because another User reported scrolling Issues in #38 (There are more problems in that Issue that I have to fix). I haven't looked too much into how the RenderChild actually works, but I thought maybe the scrolling issues stop if the height doesn't change when the chart gets destroyed.
Will remove that line and investigate further.
Hmm what you may be dealing with is the fact that cm6 optimizes the rendering by taking out elements that are not in view.
clientHeight
will be 0 when an element is detached from DOM, so at the very least you can test for that.
There's one other thing you could consider using and it's the Element.onNodeInserted(callback)
helper function that Obsidian provides - you'll get a call every time the element is inserted and displayed in the app. Attach this on your canvas and from there you can possibly do some checks and if it's in a screwed up state, you can consider re-rendering.
Describe the bug
Relevant errors (if available)
Steps to reproduce
Expected Behavior
It doesn't set the height to zero after changing a value and switching to reading mode.
Additional context
HTML and CSS on initial load:
HTML and css after a change in the data and switching to reading mode:
Code