iTwin / appui

Monorepo for iTwin.js AppUi
MIT License
8 stars 2 forks source link

ResizeObserver error thrown when ButtonGroup is used in Widget #240

Closed saskliutas closed 1 year ago

saskliutas commented 1 year ago

Describe the bug ResizeObserver loop limit exceeded error is thrown when ButtonGroup component from @itwin/itwinui-react package is used in Widget.

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/saskliutas/itwin-viewer-app
  2. Setup .env file using instructions in README file
  3. Launch app
  4. Click Collapse button from Widget in right panel

Expected behavior Error should not be thrown

Screenshots image image

Desktop (please complete the applicable information):

Additional context Tried to reproduce same error in fresh react app created with vite and create-react-app using only @itwin/itwinui-react. Also tried to reproduce this in iTwin.js sandbox and codesandbox.io. It looks like this error is only thrown in development mode and only when ButtonGroup is used in appui Widget.

a-gagnon commented 1 year ago

Getting the same loop limit exceeded problem when popping out then closing a widget that uses the useLayoutResizeObserver hook. I reverted back to an older version of our code that pulls itwinjs 3.6.0 and it works properly there.

raplemie commented 1 year ago

Hi, OP issue can actually be recreated by using your provided "MyComponent" in a create-react-app but only when using React17 (rather than the default React18, which work fine) I'll follow up with iTwinUI teams and get back to you, we may transfer the issue there.

raplemie commented 1 year ago

Created itwin/itwinui#1317, will close this one. @a-gagnon Please create a different issue if its unrelated to iTwinUI components.