davidjerleke / embla-carousel

A lightweight carousel library with fluid motion and great swipe precision.
https://www.embla-carousel.com
MIT License
6.01k stars 180 forks source link

Uncaught "ResizeObserver loop limit exceeded" #488

Closed hmartiins closed 1 year ago

hmartiins commented 1 year ago

Bug is related to

Embla Carousel version

Describe the bug

Steps to reproduce

I just browsed my website and every time I entered the page I had this message

Expected behavior

Additional context

image

davidjerleke commented 1 year ago

@hmartiins please share more helpful information when creating a bug report. For example, this bug report is very clear and doesn’t leave you with many questions. At the time of writing I have no idea how to reproduce this.

This error started happening right when I migrated to version 8.0.0-rc05.

VadymBezsmertnyi commented 1 year ago

In the Safari 16.4 (18615.1.26.110.1) browser console, when using embla-carousel 8.0.0-rc02 to 8.0.0-rc05, the following error occurs: [Error] ResizeObserver loop completed with undelivered notifications. However, when using embla-carousel 7.1.0, there are no errors. I am using embla-carousel for a regular React application. Additionally, if I add watchResize: false to the settings of useEmblaCarousel where embla-carousel is used, the error also disappears. Occasionally, it also appears on Chrome, but I haven't been able to track when and how it happens.

davidjerleke commented 1 year ago

Thanks for chiming in with additional details @VadymBezsmertnyi.

At this point I need to understand why this is happening and possible solutions. If you or anyone else has any useful information about this - please share.

davidjerleke commented 1 year ago

@hmartiins and/or @VadymBezsmertnyi when does this error appear in the console? As soon as the carousel mounts? If you have additional details on how to reproduce this, please share.

hmartiins commented 1 year ago

@davidjerleke what i noticed is when the carousel is mounted on the screen. I'll try to provide a codesandbox trying to simulate the error. The difficult thing is, I haven't encountered this error so far in a local environment, I'm just getting error messages and alerts about this in a production environment. From what I analyzed in my monitoring tool, this error occurred both in the android and in the IOS environment, so far I have not caught any reports of this error on the desktop. From the replays of the sessions in which this error occurs, the carousel does not break

davidjerleke commented 1 year ago

Thanks for the additional details @hmartiins 👍🏻. I’ll try to reproduce the error using BrowserStack then.

hmartiins commented 1 year ago

@davidjerleke So, I simulated it here on browserstack and was able to see the error on my console. It looks like it only occurs on real mobile devices.

image

davidjerleke commented 1 year ago

@hmartiins that’s very helpful. Thanks!

davidjerleke commented 1 year ago

@hmartiins that's so weird. I tried reproducing the error with BrowserStack but it did not throw any errors 😕. Additionally, your last error message is different from the first?

Would you mind creating a CodeSandbox with a carousel setup that triggers the error in BrowserStack and provide what iOS version you’re using?

There is an app view that should behave and work pretty much as any browser without the editing layers:

IMG_7131

VadymBezsmertnyi commented 1 year ago

@davidjerleke With the addition of watchResize:false in the options, it doesn't throw an error, but it doesn't resize adaptively either. To change the size of the object, a reload is needed. I also tested it on 8.0.0-rc01, and it still throws an error. The error occurs whenever there is a change in the object where embla-carousel is located or responds.

tobimori commented 1 year ago

I can confirm this error but it doesn't seem to have caused any issues

davidjerleke commented 1 year ago

Allright I was finally able to reproduce it. One way to do it is to flip the iPhone in BrowserStack. The error is also thrown whenever the slide container is resized.

@hmartiins, @VadymBezsmertnyi or @tobimori I would very much appreciate if you could try to reproduce the error in this CodeSandbox with the bug fix I added.

Let me know if the error is gone or not.

Best, David

tobimori commented 1 year ago

Works for me.

davidjerleke commented 1 year ago

@tobimori you mean no more ResizeObserver errors?

tobimori commented 1 year ago

@tobimori you mean no more ResizeObserver errors?

yeah

davidjerleke commented 1 year ago

@hmartiins, @VadymBezsmertnyi let me know if you're intending to test the fix too.

Best, David

VadymBezsmertnyi commented 1 year ago

Thank you, @davidjerleke . I tried your code in CodeSandbox, and the error doesn't occur. I also tried version 8.0.0-rc06 in the project, and the error is still reproducible.

davidjerleke commented 1 year ago

@hmartiins, @VadymBezsmertnyi and @tobimori, a bugfix for this problem has been released with v8.0.0-rc07. Thanks for the help 👍.

VadymBezsmertnyi commented 1 year ago

Thank you, @davidjerleke. Everything is working perfectly and without any errors in the console. Thank you!