How to Fix the ResizeObserver Loop Error
“ResizeObserver loop completed with undelivered notifications” means the browser could not deliver every resize notification in the current rendering cycle, often because a resize callback changed layout and triggered more resizing. It is a browser-generated ErrorEvent, not necessarily an application crash. The fix is to identify the observer, break any layout feedback loop, and defer necessary layout writes, not simply hide the message.
Use the symptom to choose your starting point:
| Symptom | Likely Cause | Best First Action |
|---|---|---|
| Appears briefly when opening or resizing a component, then stops | Layout changes that take another rendering cycle to settle | Check whether the interface settles without flicker or repeated errors |
| Continues while the page is idle | A resize callback repeatedly changes the size it observes | Trace the measurement-to-layout feedback loop |
| Appears when a grid or panel gets narrower | Intrinsic sizing, wrapping, or scrollbar changes | Inspect the component’s flex/grid constraints |
Stack trace points to an overlay’s handleError |
The development server is displaying a browser error event | Find the observer’s creation site instead of debugging the overlay |
| Appears only as a development error overlay | Development tooling is making the event more visible | Compare behavior and raw error events in development and production |
What the ResizeObserver Error Means
ResizeObserver lets JavaScript respond when an element’s observed box changes size. A chart, for example, may observe its container and redraw when the container becomes narrower.
The problem starts when responding to a resize causes another resize:
Container changes size
→ ResizeObserver callback runs
→ Callback changes styles or component state
→ Layout changes again
→ Another resize notification becomes necessary
Browsers deliver resize observations before painting. To prevent an unbounded delivery loop within that rendering cycle, they restrict which additional observations can be delivered. When observations remain undelivered, the browser dispatches an error event on window; those observations can be delivered in a subsequent rendering cycle.
The important distinction is that a delivery-loop warning does not, by itself, prove there is an infinite loop. A component may settle after another layout pass. But the browser’s protection also does not repair a genuine feedback loop: it can keep recurring across frames.
Treat persistent errors, visible flicker, jumping dimensions, or sustained layout work as a bug. An isolated event with a stable interface is less urgent, but still worth tracing before filtering it out.
You may also encounter the related message ResizeObserver loop limit exceeded. Keep both messages in mind when searching logs.
How to Fix the ResizeObserver Loop Error
Reproduce the trigger, identify the observer, and correct the component or layout constraints behind repeatedly changing dimensions.
Step 1: Reproduce the Trigger and Find the Observer
ResizeObserver warnings can be triggered by environment-driven layout changes, not just manual window resizing.
- Record the exact environment and interaction. Include the browser version, operating system, component version, and whether you are running a development or production build. Test the actual action: opening a dropdown, editing content, loading data, narrowing a panel, changing zoom, or moving the tab between displays.
- Isolate the component. Temporarily remove nearby charts, grids, popups, or auto-sizing controls. Test in a clean browser profile if extensions could be modifying the page.
- Find who creates the observer. Search your application and relevant dependencies for
ResizeObserverand resize-observer hooks or utilities. Put a breakpoint inside the suspected callback.
Reproduction can differ by browser and operating system, even for the same component. One forum user reported a Chrome ResizeObserver warning on saves in a Node.js TiddlyWiki instance, so include content changes, not just viewport changes, in your reproduction.
A stack trace ending in handleError often identifies the development overlay’s error listener, not the callback that caused the layout change. If the owner remains unclear, temporarily instrument observer creation.
Place this development-only snippet before your application initializes:
const OriginalResizeObserver = window.ResizeObserver;
window.ResizeObserver = class extends OriginalResizeObserver {
constructor(callback) {
const createdAt = new Error("ResizeObserver created here").stack;
super((entries, observer) => {
console.debug("ResizeObserver delivery", {
createdAt,
targets: entries.map((entry) => entry.target),
sizes: entries.map((entry) => ({
width: entry.contentRect.width,
height: entry.contentRect.height,
})),
});
callback.call(observer, entries, observer);
});
}
};
This records the creation stack, observed elements, and delivered sizes. Observers created before the snippet runs will not be wrapped.
Reproduce the issue and look for dimensions that repeatedly change or alternate. Use the creation stack to inspect what that callback changes. Remove the instrumentation and reload after identifying the candidate, since continuous logging can distort performance.
Step 2: Correct the Component or Its Layout Constraints
Start with the smallest repair that fits the reproduction.
- If a dependency owns the observer, check for a compatible update. Review its resize, overflow, popup, and positioning fixes. Verify the version actually resolved in your lockfile rather than assuming the dependency declaration tells the whole story.
- Inspect the component’s sizing constraints. Look for content forcing a flex or grid item wider than its container, percentage sizing tied to an auto-sized ancestor, or scrollbars repeatedly appearing and disappearing.
- Change one thing, then replay the trigger. Keep the change only if the component behaves correctly and the original warning no longer recurs under the same conditions.
For a flex or grid item that must shrink below its content’s intrinsic width, this targeted CSS can help:
.resizable-panel {
min-width: 0;
}
Apply that class to the item whose automatic minimum width is preventing it from shrinking, not indiscriminately to every element. Check that its contents still wrap or scroll as intended.
For scrollbar-related oscillation, inspect whether adding the scrollbar reduces available width enough to change wrapping, which then changes height and removes the scrollbar again. Stabilize the container’s sizing or scrolling behavior rather than forcing repeated JavaScript corrections.
A package update is not a guaranteed fix. Retest the actual interaction and browser combination before considering the issue resolved.
Step 3: Break the Measurement-to-Layout Feedback Loop
If your callback controls the layout, make its update converge.
- Trace what the measurement changes. Follow the path from the observed element through style writes, state updates, child rendering, and ancestor sizing.
- Make repeated updates with the same input do nothing. Calculate the desired size, compare it with the last applied or expected size, and write only when it differs.
- Replay the interaction and then stop interacting. Confirm that dimensions stabilize instead of continuing to change while the page is idle.
For example, a callback that reads an element’s width and always makes that element wider cannot converge. Adding an equality check does not help if every callback deliberately calculates a different width.
A better design is to observe a stable container and update a child whose dimensions cannot determine that container’s size. Be careful: observing a parent and resizing a child is still circular when the parent is intrinsically sized by that child.
Also keep measurements consistent:
contentRect.widthmeasures the content box.- Border-box measurements include padding and borders.
- The effect of assigning a CSS width depends on
box-sizing.
Comparing one box model with another can create repeated corrections. Fractional dimensions can also oscillate if different parts of the code round differently.
Use the sizes already supplied in observer entries where possible. Read the values you need before applying layout-changing writes, rather than alternating measurement and mutation throughout the callback.
Step 4: Schedule Necessary Layout Writes
When a resize response must change layout, requestAnimationFrame can move that work out of the current observer-delivery cycle.
- Coalesce pending updates. Keep the latest measurement and schedule only one pending animation-frame callback.
- Skip unchanged values. Deferral should not turn identical measurements into repeated component updates.
- Clean up and retest. Disconnect the observer and cancel pending frame work when the observed element is removed. Repeat the original interaction and confirm that the page settles.
This reusable helper observes an element’s content width:
function observeWidth(element, onWidthChange) {
let frame = null;
let latestWidth;
let appliedWidth;
const observer = new ResizeObserver(([entry]) => {
latestWidth = entry.contentRect.width;
if (latestWidth === appliedWidth || frame !== null) {
return;
}
frame = requestAnimationFrame(() => {
frame = null;
if (latestWidth === appliedWidth) {
return;
}
appliedWidth = latestWidth;
onWidthChange(latestWidth);
});
});
observer.observe(element);
return function stopObserving() {
observer.disconnect();
if (frame !== null) {
cancelAnimationFrame(frame);
frame = null;
}
};
}
Pass the element and your update function to observeWidth. Retain the returned cleanup function and call it when the component unmounts or before replacing the observed element.
The update function must still avoid a circular sizing dependency. Scheduling a callback that keeps enlarging its own observed target merely spreads the loop across animation frames; it does not fix it.
There is no universal debounce duration or animation-frame wrapper that makes every resize callback correct.
React and Vue ResizeObserver Cases
React and Vue components can prevent resize feedback by cleaning up observers and avoiding updates that change measured dimensions.
React Components
In React, the feedback path often runs through state:
Observed size changes
→ Callback sets state
→ Component renders with new styles or content
→ Observed size changes again
Create the observer in an effect tied to the intended DOM element, and return cleanup that disconnects it and cancels any scheduled work. Avoid recreating the observer on every render because an effect depends on an unnecessarily unstable callback or object.
Update size state only when the dimensions change. If you store dimensions in an object, creating a fresh object for identical dimensions can still cause unnecessary rendering.
React Strict Mode’s extra development setup-and-cleanup cycle can expose missing cleanup. Disabling Strict Mode may conceal that lifecycle bug; it is not a resize-loop repair.
After correcting the effect, mount and unmount the component and repeat the triggering interaction. Confirm that old observers do not remain active.
Vue Components
In Vue, the equivalent loop often connects an observer, a reactive value, and a bound style or computed layout.
Set up observation after the element exists, typically in onMounted, and release the observer and scheduled work in onBeforeUnmount or onUnmounted. If a template ref can point to a replacement element, stop observing the previous element before attaching to the new one.
Check whether a watcher or computed value changes the same dimensions the observer measures. Updating reactive state is not inherently safer than writing a style directly; either can change layout.
Vue’s nextTick() waits for Vue’s pending DOM updates. It does not guarantee a new animation frame, so it is not interchangeable with requestAnimationFrame for separating resize-related writes from the current delivery cycle.
Retest both the resize interaction and component removal to confirm stable sizing and complete cleanup.
Suppressing Only the Development Overlay
Filtering the development overlay is reasonable after you establish that the event is transient, the interface settles, and no ongoing performance problem remains. It changes presentation, not the browser’s resize behavior.
For webpack-dev-server versions that support a runtime-error predicate, merge this into your existing configuration:
module.exports = {
devServer: {
client: {
overlay: {
runtimeErrors: (error) => {
const ignoredMessages = [
"ResizeObserver loop limit exceeded",
"ResizeObserver loop completed with undelivered notifications.",
];
return !ignoredMessages.includes(error.message);
},
},
},
},
};
The runtimeErrors: (error) => { ... } callback returns false only for the two matching messages and leaves other runtime errors eligible for display.
Support varies by webpack-dev-server version and framework integration. Confirm the accepted configuration shape under devServer.client.overlay for your installed version; older integrations may not accept a function filter. If your framework manages the server configuration, use its supported configuration mechanism rather than editing generated files.
Restart the development server, reproduce the interaction, and verify that unrelated runtime errors still surface. The filter does not prevent browser error events or remove events already captured by production monitoring.
For monitoring, use a narrowly scoped message filter only after diagnosis, and preserve a way to detect regressions. Avoid disabling the entire runtime overlay or swallowing all window error events.
How to Confirm the Fix and Prevent Recurrence
Validate the underlying behavior:
- Repeat the original interaction. Use the browser, component state, and layout that triggered the event.
- Check both directions of resizing. Narrowing and widening can exercise different wrapping and scrollbar behavior.
- Let the page sit idle. Dimensions and resize callbacks should settle rather than continue oscillating.
- Check raw error events or monitoring. Confirm that a filter has not merely hidden the symptom.
- Compare development and production builds. Production may lack the overlay while still generating the event.
- Check lifecycle cleanup. Removed components should not keep observers or scheduled updates alive.
- Inspect performance if the page still feels slow. Check for repeated layout and paint activity.
Prevent recurrence by keeping measurement separate from layout mutation, making size updates idempotent, and giving each observer a clear cleanup path.
If the issue persists inside a dependency, create a minimal reproduction with the triggering interaction, resolved package versions, browser and operating system, and relevant container CSS. That is more useful for diagnosing the defect than an overlay stack trace alone.
Frequently Asked Questions
Does Debouncing ResizeObserver Fix the Error?
Debouncing can reduce resize work, but it does not automatically remove the layout dependency causing the error. A trailing debounce may delay updates while resizing continues, and some throttle implementations still run their first callback synchronously. Use it when delayed updates fit the component’s behavior, not as a substitute for making sizing converge.
Why Does Opening a Combobox Trigger the Error?
Opening a combobox can mount a popup, measure its contents, reposition it, and change overflow or available space. Those operations can interact with a resize observer in the control or its positioning library. Compare the closed input with the open popup, then isolate custom widths, option rendering, and container styles to find which change causes repeated measurement.
How Do I Fix It in Ant Design DatePicker?
There is no universal DatePicker-specific patch for this browser error. Reduce the reproduction to a DatePicker without custom popup content or surrounding layout overrides, then reintroduce those changes individually while checking the installed component version. If the calendar opens correctly and sizing settles, diagnose the remaining event; if it flickers or repeatedly repositions, repair the popup’s sizing dependency.
