react-with-available-width icon indicating copy to clipboard operation
react-with-available-width copied to clipboard

Resizing triggering too often

Open trotzig opened this issue 8 years ago • 2 comments

I need to continue exploring how the ResizeObserver should be used optimally. Right now it triggers a few times as part of rendering.

trotzig avatar Apr 01 '17 14:04 trotzig

Debounce might help. Also when you are looking into this, make sure to see what it looks like when using this hoc in a bunch of places in different parts of the tree all at the same time--when mounting, updating, and unmounting some things.

lencioni avatar Apr 01 '17 15:04 lencioni

Yeah, so far it looks like ResizeObserver has its own debounce built-in. I did add some code to avoid resetting the width when the container element width hasn't changed.

I'll add a more complex example to test out the lifecycle a little better.

trotzig avatar Apr 02 '17 21:04 trotzig