From aaa1c6514c1e8a79f52a61305e609b2e6cb1501b Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Sun, 5 May 2024 20:08:32 +0530 Subject: [PATCH] try out requestAnimationFrame in production --- .../mui-base/src/TextareaAutosize/TextareaAutosize.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx index a66407f984..e784719ee4 100644 --- a/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx +++ b/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx @@ -139,10 +139,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize( const handleResize = () => { syncHeight(); }; - // Workaround a "ResizeObserver loop completed with undelivered notifications" error - // in test. - // Note that we might need to use this logic in production per https://github.com/WICG/resize-observer/issues/38 - // Also see https://github.com/mui/mui-x/issues/8733 + // Workaround a "ResizeObserver loop completed with undelivered notifications" error. let rAF: any; const rAFHandleResize = () => { cancelAnimationFrame(rAF); @@ -159,9 +156,7 @@ const TextareaAutosize = React.forwardRef(function TextareaAutosize( let resizeObserver: ResizeObserver; if (typeof ResizeObserver !== 'undefined') { - resizeObserver = new ResizeObserver( - process.env.NODE_ENV === 'test' ? rAFHandleResize : handleResize, - ); + resizeObserver = new ResizeObserver(rAFHandleResize); resizeObserver.observe(input); }