IO-3183-Dependency-Updates-and-maintenance - Cleaning dashboard-grid.component.jsx
This commit is contained in:
@@ -2,8 +2,7 @@ import Icon, { SyncOutlined } from "@ant-design/icons";
|
||||
import { useMutation, useQuery } from "@apollo/client";
|
||||
import { Button, Dropdown, Space } from "antd";
|
||||
import { PageHeader } from "@ant-design/pro-layout";
|
||||
import _ from "lodash";
|
||||
import React, { useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import { Responsive, WidthProvider } from "react-grid-layout";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { MdClose } from "react-icons/md";
|
||||
@@ -20,6 +19,7 @@ import componentList from "./componentList.js";
|
||||
import createDashboardQuery from "./createDashboardQuery.js";
|
||||
|
||||
import "./dashboard-grid.styles.scss";
|
||||
import cloneDeep from "lodash/cloneDeep";
|
||||
|
||||
const ResponsiveReactGridLayout = WidthProvider(Responsive);
|
||||
|
||||
@@ -71,7 +71,7 @@ export function DashboardGridComponent({ currentUser, bodyshop }) {
|
||||
logImEXEvent("dashboard_remove_component", { name: key });
|
||||
const idxToRemove = state.items.findIndex((i) => i.i === key);
|
||||
|
||||
const items = _.cloneDeep(state.items);
|
||||
const items = cloneDeep(state.items);
|
||||
|
||||
items.splice(idxToRemove, 1);
|
||||
setState({ ...state, items });
|
||||
@@ -94,7 +94,7 @@ export function DashboardGridComponent({ currentUser, bodyshop }) {
|
||||
});
|
||||
};
|
||||
|
||||
const dashboarddata = React.useMemo(() => GenerateDashboardData(data), [data]);
|
||||
const dashboardData = useMemo(() => GenerateDashboardData(data), [data]);
|
||||
const existingLayoutKeys = state.items.map((i) => i.i);
|
||||
|
||||
const menuItems = Object.keys(componentList).map((key) => ({
|
||||
@@ -156,7 +156,7 @@ export function DashboardGridComponent({ currentUser, bodyshop }) {
|
||||
}}
|
||||
onClick={() => handleRemoveComponent(item.i)}
|
||||
/>
|
||||
<TheComponent className="dashboard-card" bodyshop={bodyshop} data={dashboarddata} />
|
||||
<TheComponent className="dashboard-card" bodyshop={bodyshop} data={dashboardData} />
|
||||
</LoadingSkeleton>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user