Skip to content

Commit

Permalink
fix(CodeEditor) resizeObserver resize loop (#10644)
Browse files Browse the repository at this point in the history
* fix(CodeEditor) resizeObserver resize loop

* yarn

* add debounce

---------

Co-authored-by: Titani <tlabaj@redhat.com>
  • Loading branch information
Dominik-Petrik and tlabaj authored Jul 11, 2024
1 parent b343abb commit 73bb00a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-core/src/helpers/resizeObserver.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { canUseDOM } from './util';
import { canUseDOM, debounce } from './util';

/**
* This function creates a ResizeObserver used to handle resize events for the given containerRef. If ResizeObserver
Expand Down Expand Up @@ -83,7 +83,7 @@ export const getResizeObserver = (
if (useRequestAnimationFrame) {
window.requestAnimationFrame(() => {
if (Array.isArray(entries) && entries.length > 0) {
handleResize();
debounce(handleResize, 100);
}
});
// Avoid wrapping function in requestAnimationFrame if the function is debounced
Expand Down

0 comments on commit 73bb00a

Please sign in to comment.