Skip to content

Commit

Permalink
Table: fix resizeObserver loop limit exceeded (#21255)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomieric committed Oct 15, 2021
1 parent 5e037ce commit 5390f40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/resize-event.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ResizeObserver from 'resize-observer-polyfill';
import { debounce } from 'throttle-debounce';

const isServer = typeof window === 'undefined';

Expand All @@ -19,7 +20,7 @@ export const addResizeListener = function(element, fn) {
if (isServer) return;
if (!element.__resizeListeners__) {
element.__resizeListeners__ = [];
element.__ro__ = new ResizeObserver(resizeHandler);
element.__ro__ = new ResizeObserver(debounce(16, resizeHandler));

This comment has been minimized.

Copy link
@DamonCais

DamonCais Oct 27, 2022

建议改成 debounce(16, true, resizeHandler) 在首次执行时触发方法,解决表格组件抖动问题。

element.__ro__.observe(element);
}
element.__resizeListeners__.push(fn);
Expand Down

0 comments on commit 5390f40

Please sign in to comment.