Client: GroupsTableItem: Fix scroll lags and maximum update exceed error caused by large number of re-renders in Groups table

This commit is contained in:
Aleksandr Lushkin 2024-06-06 16:51:18 +02:00
parent 12d5bc8a1a
commit 5820e91940

View File

@ -26,17 +26,12 @@
import React from "react"; import React from "react";
import { withTranslation } from "react-i18next"; import { withTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom"; import { TableCell } from "@docspace/shared/components/table";
import { TableRow, TableCell } from "@docspace/shared/components/table";
import { Link } from "@docspace/shared/components/link"; import { Link } from "@docspace/shared/components/link";
import { Checkbox } from "@docspace/shared/components/checkbox"; import { Checkbox } from "@docspace/shared/components/checkbox";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import withContent from "SRC_DIR/HOCs/withPeopleContent";
import * as Styled from "./index.styled"; import * as Styled from "./index.styled";
import Badges from "../../Badges";
import { Base } from "@docspace/shared/themes";
import { Events } from "@docspace/shared/enums";
import { Text } from "@docspace/shared/components/text"; import { Text } from "@docspace/shared/components/text";
import { Avatar } from "@docspace/shared/components/avatar"; import { Avatar } from "@docspace/shared/components/avatar";
@ -46,7 +41,6 @@ const GroupsTableItem = ({
itemIndex, itemIndex,
theme, theme,
hideColumns, hideColumns,
selection,
bufferSelection, bufferSelection,
getGroupContextOptions, getGroupContextOptions,
openGroupAction, openGroupAction,
@ -55,8 +49,8 @@ const GroupsTableItem = ({
changeGroupSelection, changeGroupSelection,
changeGroupContextSelection, changeGroupContextSelection,
selectRow, selectRow,
isChecked,
}) => { }) => {
const isChecked = selection.includes(item);
const isActive = bufferSelection?.id === item.id; const isActive = bufferSelection?.id === item.id;
const onChange = () => { const onChange = () => {
@ -162,7 +156,6 @@ const GroupsTableItem = ({
}; };
export default inject(({ peopleStore }) => ({ export default inject(({ peopleStore }) => ({
selection: peopleStore.groupsStore.selection,
bufferSelection: peopleStore.groupsStore.bufferSelection, bufferSelection: peopleStore.groupsStore.bufferSelection,
getGroupContextOptions: peopleStore.groupsStore.getGroupContextOptions, getGroupContextOptions: peopleStore.groupsStore.getGroupContextOptions,
openGroupAction: peopleStore.groupsStore.openGroupAction, openGroupAction: peopleStore.groupsStore.openGroupAction,