Skip to content

Commit

Permalink
[Fix] Render issue in scatter plot with regression lines (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 authored Dec 13, 2024
1 parent a6b6c15 commit c738621
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 386 deletions.
9 changes: 7 additions & 2 deletions geoda-ai/src/components/plots/echarts-updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ const debouncedOnSelected = debounce(
500
);

// Move the debounced dispatch outside the function to avoid recreating it on every call
const debouncedDispatch = debounce((dispatch: Dispatch<any>, action: any) => {
dispatch(action);
}, 100);

export function onBrushSelected(
params: any,
dispatch: Dispatch<any>,
Expand Down Expand Up @@ -86,7 +91,7 @@ export function onBrushSelected(
if (brushed.length > 0) {
// Debounce the onSelected callback
debouncedOnSelected({dataId, filteredIndex: brushed}, onSelected);
// Dispatch action to highlight selected in other components
dispatch(geodaBrushLink({sourceId: id, dataId, filteredIndex: brushed}));
// Debounce the dispatch
debouncedDispatch(dispatch, geodaBrushLink({sourceId: id, dataId, filteredIndex: brushed}));
}
}
Loading

0 comments on commit c738621

Please sign in to comment.