Skip to content

Commit 66adde7

Browse files
committed
[v4] [table] fix(TableQuadrantStack): cancel setTimeout on unmount
1 parent 8c038a0 commit 66adde7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/table/src/quadrants/tableQuadrantStack.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,8 @@ export class TableQuadrantStack extends AbstractComponent2<ITableQuadrantStackPr
304304

305305
private throttledHandleWheel: (event: React.WheelEvent<HTMLElement>) => any;
306306

307-
// the interval instance that we maintain to enable debouncing of view
308-
// updates on scroll
309-
private debouncedViewSyncInterval?: number;
307+
// cancel function for the debounced view sync handler
308+
private cancelPendingViewSync?: () => void;
310309

311310
private cache: TableQuadrantStackCache;
312311

@@ -813,8 +812,8 @@ export class TableQuadrantStack extends AbstractComponent2<ITableQuadrantStackPr
813812
this.syncQuadrantViews();
814813
} else {
815814
// update asynchronously after a debounced delay
816-
clearInterval(this.debouncedViewSyncInterval);
817-
this.debouncedViewSyncInterval = window.setTimeout(this.syncQuadrantViews, viewSyncDelay);
815+
this.cancelPendingViewSync?.();
816+
this.cancelPendingViewSync = this.setTimeout(this.syncQuadrantViews, viewSyncDelay);
818817
}
819818
};
820819

0 commit comments

Comments
 (0)