Skip to content

Commit

Permalink
Reduce render looping
Browse files Browse the repository at this point in the history
  • Loading branch information
jassmith committed Aug 1, 2022
1 parent 1103067 commit 20c0c01
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/core/src/data-editor/data-editor.tsx
Expand Up @@ -1588,11 +1588,12 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
location: [args.location[0] - rowMarkerOffset, args.location[1]] as any,
};
onMouseMove?.(a);
setScrollDir(
mouseState === undefined || (mouseDownData.current?.location[0] ?? 0) < rowMarkerOffset
setScrollDir(cv => {
if (args.scrollEdge[0] === cv?.[0] && args.scrollEdge[1] === cv[1]) return cv;
return mouseState === undefined || (mouseDownData.current?.location[0] ?? 0) < rowMarkerOffset
? undefined
: args.scrollEdge
);
: args.scrollEdge;
});
},
[mouseState, onMouseMove, rowMarkerOffset]
);
Expand Down

0 comments on commit 20c0c01

Please sign in to comment.