Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
romgrk committed May 25, 2023
1 parent 4676c45 commit 463de84
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export const useGridColumnResize = (
logger.debug(
`Updating col ${colDefRef.current!.field} with new width: ${colDefRef.current!.width}`,
);
}
};

// Prevent the click event if we have resized the column.
// Fixes https://github.com/mui/mui-x/issues/4777
Expand Down Expand Up @@ -414,8 +414,15 @@ export const useGridColumnResize = (
// has been canceled before removing our handler.
Promise.resolve().then(() => {
doc.removeEventListener('click', handleClick, true);
})
}, [apiRef, handleResizeMouseMove, handleResizeMouseUp, handleTouchMove, handleTouchEnd, handleClick]);
});
}, [
apiRef,
handleResizeMouseMove,
handleResizeMouseUp,
handleTouchMove,
handleTouchEnd,
handleClick,
]);

const handleResizeStart = React.useCallback<GridEventListener<'columnResizeStart'>>(
({ field }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,19 @@ describe('<DataGridPro /> - Columns', () => {

/* XXX: Does not reproduce the original issue */
it('should not trigger a click on the header after resizing', () => {
const columns = [{ field: 'id', minWidth: 100 }, { field: 'brand', width: 100 }];
const columns = [
{ field: 'id', minWidth: 100 },
{ field: 'brand', width: 100 },
];
render(
<Test
columns={columns}
initialState={{
sorting: {
sortModel: [{ field: 'brand', sort: 'asc' }],
}
},
}}
/>
/>,
);
const separator = document.querySelector(`.${gridClasses['columnSeparator--resizable']}`)!;
const header = document.querySelector(`.${gridClasses['columnHeader']}`)!;
Expand Down

0 comments on commit 463de84

Please sign in to comment.