Skip to content

Commit

Permalink
fix(events): remove async callbacks from code (#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 authored Jun 28, 2022
1 parent 61de6c2 commit 27a7256
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export function createOnProjectionAreaCaller(): (state: GlobalChartState) => voi
isDiff(prevProps.projection, nextProps.projection) ||
isDiff(nextProps.parent, nextProps.parent);
if (onProjectionAreaChange && areDifferent) {
requestAnimationFrame(() => {
onProjectionAreaChange(nextProps);
});
onProjectionAreaChange(nextProps);
}
prevProps = nextProps;
},
Expand Down
11 changes: 1 addition & 10 deletions packages/charts/src/components/chart_container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,7 @@ class ChartContainerComponent extends React.Component<ReactiveChartProps> {
const { onMouseUp } = this.props;

window.removeEventListener('mouseup', this.handleBrushEnd);

requestAnimationFrame(() => {
onMouseUp(
{
x: -1,
y: -1,
},
Date.now(),
);
});
onMouseUp({ x: -1, y: -1 }, Date.now());
};

render() {
Expand Down
7 changes: 1 addition & 6 deletions packages/charts/src/components/chart_status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ class ChartStatusComponent extends React.Component<ChartStatusStateProps> {
}

dispatchRenderChange = () => {
const { onRenderChange, rendered } = this.props;
if (onRenderChange) {
window.requestAnimationFrame(() => {
onRenderChange(rendered);
});
}
this.props.onRenderChange?.(this.props.rendered);
};

render() {
Expand Down

0 comments on commit 27a7256

Please sign in to comment.