Skip to content

Commit

Permalink
Fix lodash imports
Browse files Browse the repository at this point in the history
  • Loading branch information
semkedaniil committed Oct 25, 2023
1 parent d48e634 commit b8e5032
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isValid, parse as parseDateInternal } from "date-fns";
import _ from "lodash";
import difference from "lodash/difference";

import { DateTimeRange } from "../DataTypes/DateTimeRange";
import { DateUtils } from "../Utils/DateUtils";
Expand Down Expand Up @@ -255,7 +255,7 @@ export class SetMapper<T> extends PlainValueMapper<T[]> {
let values;
if (this.allowNegationOperator && parameterValue[0] === "!") {
const negatedValues = parameterValue.replace(/^!/, "").split(" ");
values = _.difference(this.getKeys(), negatedValues);
values = difference(this.getKeys(), negatedValues);
} else {
values = parameterValue.split(" ");
}
Expand All @@ -271,7 +271,7 @@ export class SetMapper<T> extends PlainValueMapper<T[]> {

public buildNegativeValuesString(values: T[]): string {
const positiveValues = values.map(x => this.getString(x)).filter(x => x !== null);
const negativeValues = _.difference(this.getKeys(), positiveValues);
const negativeValues = difference(this.getKeys(), positiveValues);
return "!" + negativeValues.join(" ");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ColumnStack, Fit } from "@skbkontur/react-stack-layout";
import { ThemeContext } from "@skbkontur/react-ui";
import _ from "lodash";
import reverse from "lodash/reverse";
import sortBy from "lodash/sortBy";
import uniq from "lodash/uniq";
import React from "react";
import { Location } from "react-router-dom";

Expand Down Expand Up @@ -88,9 +90,9 @@ export function TaskChainTree({ taskDetails, getTaskLocation }: TaskChainTreePro
let mostParentTasks = Object.getOwnPropertyNames(taskMetaHashSet)
.map(x => taskMetaHashSet[x])
.map(x => findMostParentTask(taskMetaHashSet, x));
mostParentTasks = _.uniq(mostParentTasks);
mostParentTasks = _.sortBy(mostParentTasks, x => x.taskMeta.ticks);
mostParentTasks = _.reverse(mostParentTasks);
mostParentTasks = uniq(mostParentTasks);
mostParentTasks = sortBy(mostParentTasks, x => x.taskMeta.ticks);
mostParentTasks = reverse(mostParentTasks);
return mostParentTasks;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Fit, RowStack } from "@skbkontur/react-stack-layout";
import { ThemeContext, Button, Modal } from "@skbkontur/react-ui";
import { Theme } from "@skbkontur/react-ui/lib/theming/Theme";
import _ from "lodash";
import isEqual from "lodash/isEqual";
import React from "react";
import { Location } from "react-router-dom";

Expand Down Expand Up @@ -35,11 +35,11 @@ export class TasksTable extends React.Component<TaskTableProps, TasksTableState>

public shouldComponentUpdate(nextProps: TaskTableProps, nextState: TasksTableState): boolean {
return (
!_.isEqual(this.props.taskInfos, nextProps.taskInfos) ||
!_.isEqual(this.props.allowRerunOrCancel, nextProps.allowRerunOrCancel) ||
!_.isEqual(this.state.openedModal, nextState.openedModal) ||
!_.isEqual(this.state.modalType, nextState.modalType) ||
!_.isEqual(this.state.actionTask, nextState.actionTask)
!isEqual(this.props.taskInfos, nextProps.taskInfos) ||
!isEqual(this.props.allowRerunOrCancel, nextProps.allowRerunOrCancel) ||
!isEqual(this.state.openedModal, nextState.openedModal) ||
!isEqual(this.state.modalType, nextState.modalType) ||
!isEqual(this.state.actionTask, nextState.actionTask)
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Loader } from "@skbkontur/react-ui";
import _ from "lodash";
import difference from "lodash/difference";
import uniq from "lodash/uniq";
import { useEffect, useState } from "react";
import { Location, useLocation } from "react-router-dom";

Expand Down Expand Up @@ -58,7 +59,7 @@ export const TaskChainsTreeContainer = ({
.map(({ childTaskIds, taskMeta: { parentTaskId } }) => [parentTaskId, ...(childTaskIds || [])])
.flat()
.filter(isNotNullOrUndefined);
return _.uniq(linkedIds);
return uniq(linkedIds);
};

const getTaskLocation = (id: string): string | Partial<Location> => ({ pathname: `../${id}` });
Expand Down Expand Up @@ -99,7 +100,7 @@ export const TaskChainsTreeContainer = ({
setLoading(true);
setLoaderText(`Загрузка задач: ${taskDetails.length}`);
const parentAndChildrenTaskIds = getParentAndChildrenTaskIds(loadedTaskDetails);
taskIdsToLoad = _.difference(parentAndChildrenTaskIds, allTaskIds);
taskIdsToLoad = difference(parentAndChildrenTaskIds, allTaskIds);
taskDetails = [...taskDetails, ...loadedTaskDetails];
if (iterationCount > 50) {
break;
Expand Down

0 comments on commit b8e5032

Please sign in to comment.