Skip to content

Commit

Permalink
[material-next][Slider] Replace lodash with internal utils (mui#40261)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoAndai authored Dec 27, 2023
1 parent 88b2273 commit e2c3884
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
'use client';
import * as React from 'react';
import { Axis } from '@mui/base';
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
import { debounce, isEqual } from 'lodash';
import { Axis, areArraysEqual } from '@mui/base';
import {
unstable_useEnhancedEffect as useEnhancedEffect,
unstable_debounce as debounce,
} from '@mui/utils';

const overlapCompareFunctionByAxis = {
horizontal: (firstElementRect: DOMRect, secondElementRect: DOMRect, margin: number) =>
Expand Down Expand Up @@ -52,7 +54,7 @@ function useElementsOverlap(axis: Axis, margin: number = 0) {
const onMove = React.useCallback(() => {
if (elementsRefList.current.length > 1) {
const updatedOverlap = getSliderElementsOverlap(elementsRefList.current, axis, margin);
if (!isEqual(updatedOverlap, elementsOverlapArray)) {
if (!areArraysEqual(updatedOverlap, elementsOverlapArray)) {
setElementsOverlapArray(updatedOverlap);
}
}
Expand Down

0 comments on commit e2c3884

Please sign in to comment.