Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum update depth exceeded #6003

Open
dmitryTurov opened this issue Feb 3, 2025 · 0 comments
Open

Maximum update depth exceeded #6003

dmitryTurov opened this issue Feb 3, 2025 · 0 comments
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@dmitryTurov
Copy link

react-select version:
5.8.3

production sentry caught the error:
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

call stack:

  1. /node_modules/react-select/dist/index-641ee5b8.esm.js in setMenuPortalElement at line 709:5

useLayoutEffect(function () {
runAutoUpdate();
}, [runAutoUpdate]);
var setMenuPortalElement = useCallback(function (menuPortalElement) {
menuPortalRef.current = menuPortalElement;
runAutoUpdate();
}, [runAutoUpdate]);
// bail early if required elements aren't present
if (!appendTo && menuPosition !== 'fixed' || !computedPosition) return null;

  1. /node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs in cleanupRef.current at line 627:1

resizeObserver = null;
if (animationFrame) {
cancelAnimationFrame(frameId);
}
};
}
/**

  • Resolves with an object of overflow side offsets that determine how much the
  • element is overflowing a given clipping boundary on each side.
    • positive = overflowing the boundary by that number of pixels
  1. /node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs in cleanupRef.current at line 613:3

    update();
    }
    prevRefRect = nextRefRect;
    frameId = requestAnimationFrame(frameLoop);
    }
    update();
    return () => {
    var _resizeObserver2;
    ancestors.forEach(ancestor => {
    ancestorScroll && ancestor.removeEventListener('scroll', update);
    ancestorResize && ancestor.removeEventListener('resize', update);

  2. /node_modules/react-select/dist/index-641ee5b8.esm.js in updateComputedPosition at line 684:7

if (!controlElement) return;
var rect = getBoundingClientObj(controlElement);
var scrollDistance = menuPosition === 'fixed' ? 0 : window.pageYOffset;
var offset = rect[placement] + scrollDistance;
if (offset !== (computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset) || rect.left !== (computedP {snip}
setComputedPosition({
offset: offset,
rect: rect
});
}
}, [controlElement, menuPosition, placement, computedPosition === null || computedPosition === void 0 ? void 0 : computedPosition.offset, {snip}

  1. then react-dom throws the update depth error
@dmitryTurov dmitryTurov added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

No branches or pull requests

1 participant