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

[v4] [table] fix(TableQuadrantStack): cancel handler on unmount #5124

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/table/src/quadrants/tableQuadrantStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,8 @@ export class TableQuadrantStack extends AbstractComponent2<ITableQuadrantStackPr

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

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

private cache: TableQuadrantStackCache;

Expand Down Expand Up @@ -813,8 +812,8 @@ export class TableQuadrantStack extends AbstractComponent2<ITableQuadrantStackPr
this.syncQuadrantViews();
} else {
// update asynchronously after a debounced delay
clearInterval(this.debouncedViewSyncInterval);
this.debouncedViewSyncInterval = window.setTimeout(this.syncQuadrantViews, viewSyncDelay);
this.cancelPendingViewSync?.();
this.cancelPendingViewSync = this.setTimeout(this.syncQuadrantViews, viewSyncDelay);
}
};

Expand Down