Skip to content
  1. LuzineDebug
  2. Web, HTML & CSS
  3. ResizeObserver loop completed with undelivered n…
Web, HTML & CSS Intermediate ≈ 10 min to fix

Fix "ResizeObserver loop completed with undelivered notifications"

Error message
ResizeObserver loop completed with undelivered notifications.
  • ResizeObserver loop limit exceeded
  • Uncaught runtime errors: ERROR ResizeObserver loop completed with undelivered notifications.
  • Error: ResizeObserver loop completed with undelivered notifications. at handleError (webpack-internal:///./node_modules/webpack-dev-server/client/overlay.js)
  • The following error originated from your application code, not from Cypress. > ResizeObserver loop completed with undelivered notifications.
In short

A ResizeObserver callback changed the size of an observed element during the same frame, and the browser postponed the remaining notifications to the next frame. It is usually harmless: nothing breaks for the user. If the code is yours, apply the change inside requestAnimationFrame; if it comes from a library, filter this message in the dev overlay, Cypress and Sentry.

Be the first to confirm this fix

What this error means

ResizeObserver tells your code when an element changes size. If the callback in turn changes the layout (textarea height, chart width), it can trigger a new notification within the same frame, or even an infinite loop. To prevent that, the browser only processes deeper elements in the DOM within a frame, postpones the others to the next frame and reports it as an error on window, with no stack trace. Chrome used to show "loop limit exceeded"; the current text is the same in every browser. It mostly becomes blocking in tools that turn any global error into a failure: the webpack-dev-server overlay, Cypress, Sentry.

Common causes

  1. UI library adjusting its own size: auto-resizing textarea, Autocomplete or Select (MUI, Ant Design), Monaco editor, AG Grid, Recharts ResponsiveContainer.
  2. Your own callback synchronously changing the size of the observed element (or a parent), for example through a setState that changes its height.
  3. Unstable layout: content that makes a scrollbar appear and disappear, which changes the width, which changes the height…

Step-by-step fix

  1. Check whether it matters

    If the UI renders correctly and the message only shows in the console or the dev overlay, it is harmless. If there is flickering or a layout that keeps oscillating, look for the loop in your code.

  2. In your code: defer the change

    Apply the layout changes on the next frame, and do nothing if the size did not really change, to break the loop.

    javascript
    let lastWidth = 0;
    
    const observer = new ResizeObserver((entries) => {
      requestAnimationFrame(() => {
        for (const entry of entries) {
          const width = Math.round(entry.contentRect.width);
          if (width === lastWidth) continue;
          lastWidth = width;
          // update the layout here
        }
      });
    });
    
    observer.observe(document.querySelector('#chart'));
  3. Update the library involved

    Many components (MUI, Ant Design, Monaco, Recharts) fixed or reduced this behaviour in recent versions. Identify the component by temporarily removing it from the page.

    bash
    npm outdated
    npm install @mui/material@latest
  4. Filter the webpack-dev-server overlay

    With webpack-dev-server 4.15 or later (ejected Create React App, custom webpack config), runtimeErrors accepts a function that decides which errors to show.

    javascript
    // webpack.config.js
    module.exports = {
      devServer: {
        client: {
          overlay: {
            runtimeErrors: (error) => !error.message.includes('ResizeObserver loop'),
          },
        },
      },
    };
  5. Ignore this message in Cypress and Sentry

    Only hide this exact message: other errors must still fail the tests and reach error tracking.

    javascript
    // cypress/support/e2e.js
    Cypress.on('uncaught:exception', (err) => {
      if (err.message.includes('ResizeObserver loop')) return false;
    });
    
    // Sentry
    Sentry.init({
      dsn: '...',
      ignoreErrors: [/ResizeObserver loop/],
    });

Did this fix work for you?

Confirm it in one click: it will rise for the next developers stuck on the same error.

Keep it from coming back

  • In a ResizeObserver callback, never change the size of the observed element directly: go through requestAnimationFrame and compare with the previous size.
  • Reserve scrollbar space with scrollbar-gutter: stable to avoid width oscillations.
  • Keep your UI libraries up to date and only ignore this message in a targeted way, never all global errors.

Frequently asked questions

Do my users see this error?

No: it only appears in the console. It does not stop the script and the layout finishes on the next frame. The problem is the noise in overlays, tests and error tracking.

What is the difference with "ResizeObserver loop limit exceeded"?

It is the old Chrome wording for the same mechanism. All browsers now use "loop completed with undelivered notifications". Filter both with ResizeObserver loop.

Why is there no stack trace?

The browser reports the error itself between two frames, outside any call from your code. To find the culprit, disable components one by one or add a breakpoint in your ResizeObserver callbacks.

Useful tools for this error

More Web, HTML & CSS errors

All Web, HTML & CSS errors →