Like in react dialog component, you set up it’s inner component data with setTimeout
100ms delay, and you use ResizeObserver
to get it’s inner component size
attribute. The target getBoundingClientRect
can not get the true size while offsetWidth
can. I run the getBoundingClientRect
in the requestAnimationframe
and I can see the two results has some difference.
So What lead to this result? I think getBoundingClientRect
should stuck the js thread and reflow and return the true result as when we read offsetWidth
.
How do you think about that.