mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 21:03:29 +00:00
performance: memo
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Icon from '@chakra-ui/icon';
|
||||
import { FiChevronDown, FiChevronUp, FiMoreVertical } from 'react-icons/fi';
|
||||
import { memo, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { Draggable } from 'react-beautiful-dnd';
|
||||
import EventTimes from '../../../common/components/eventTimes/EventTimes';
|
||||
import EventTimesVertical from '../../../common/components/eventTimes/EventTimesVertical';
|
||||
@@ -11,16 +11,6 @@ import DeleteIconBtn from '../../../common/components/buttons/DeleteIconBtn';
|
||||
import { millisToMinutes } from '../../../common/dateConfig';
|
||||
import style from './EventBlock.module.css';
|
||||
|
||||
const areEqual = (prevProps, nextProps) => {
|
||||
return (
|
||||
prevProps.data.revision === nextProps.data.revision &&
|
||||
prevProps.selected === nextProps.selected &&
|
||||
prevProps.next === nextProps.next &&
|
||||
prevProps.index === nextProps.index &&
|
||||
prevProps.delay === nextProps.delay
|
||||
);
|
||||
};
|
||||
|
||||
const ExpandedBlock = (props) => {
|
||||
const { provided, data, next, delay, delayValue, actionHandler } = props;
|
||||
|
||||
@@ -153,7 +143,7 @@ const CollapsedBlock = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const EventBlock = (props) => {
|
||||
export default function EventBlock(props) {
|
||||
const { data, selected, delay, index, actionHandler } = props;
|
||||
|
||||
const [expanded, setExpanded] = useState(true);
|
||||
@@ -200,6 +190,4 @@ const EventBlock = (props) => {
|
||||
)}
|
||||
</Draggable>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(EventBlock, areEqual);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user