Skip to content

Commit

Permalink
Only import required lodash methods to reduce bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
cvbuelow authored and Reflejo committed Jun 30, 2023
1 parent a017403 commit 1409cdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Xarrow/useXarrowProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
xarrowPropsType,
} from '../types';
import { getElementByPropGiven, getElemPos, xStr2absRelative } from './utils';
import _ from 'lodash';
import isEqual from 'lodash/isEqual';
import { arrowShapes, cAnchorEdge, cArrowShapes } from '../constants';
import { anchorEdgeType, dimensionType } from '../privateTypes';

Expand Down Expand Up @@ -293,7 +293,7 @@ const initialValVars = {
// const parseAllProps = () => parseGivenProps(defaultProps, initialParsedProps);

function deepCompareEquals(a, b) {
return _.isEqual(a, b);
return isEqual(a, b);
}

function useDeepCompareMemoize(value) {
Expand Down
6 changes: 3 additions & 3 deletions src/Xarrow/utils/GetPosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useXarrowPropsResType } from '../useXarrowProps';
import React from 'react';
import { calcAnchors } from '../anchors';
import { getShortestLine, getSvgPos } from './index';
import _ from 'lodash';
import pick from 'lodash/pick';
import { cPaths } from '../../constants';
import { buzzierMinSols, bzFunction } from './buzzier';

Expand Down Expand Up @@ -46,8 +46,8 @@ export const getPosition = (xProps: useXarrowPropsResType, mainRef: React.Mutabl

let startAnchorPosition = chosenStart.anchor.position,
endAnchorPosition = chosenEnd.anchor.position;
let startPoint = _.pick(chosenStart, ['x', 'y']),
endPoint = _.pick(chosenEnd, ['x', 'y']);
let startPoint = pick(chosenStart, ['x', 'y']),
endPoint = pick(chosenEnd, ['x', 'y']);

let mainDivPos = getSvgPos(svgRef);
let cx0 = Math.min(startPoint.x, endPoint.x) - mainDivPos.x;
Expand Down

0 comments on commit 1409cdd

Please sign in to comment.