It works with timeout(), thanks. I am thinking where would be the best place to persist scrollbar position before removing the component from DOM to be able to restore it when the component is inserted back again.
r
Robert Jaros
01/14/2021, 4:07 PM
No idea how your code is organized, but if it is the same component it would be best to keep this info in the component itself.
t
Tomas Kormanak
01/14/2021, 4:10 PM
I would, but when to get the value? I would put it in a hook beforeRemove() if it existed.
Tomas Kormanak
01/14/2021, 4:12 PM
something like:
Copy code
var latestScrollPosition: Double = 0
fun beforeRemove() {
val element = getElement()
latestScrollPosition = element.scrollTop
}