From da0b5277152a46d4ba93502de9e8e52642d92540 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 27 Sep 2020 09:30:05 -0700 Subject: [PATCH] Do not re-render rows excessively --- .../scripts/components/server/files/FileObjectRow.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/scripts/components/server/files/FileObjectRow.tsx b/resources/scripts/components/server/files/FileObjectRow.tsx index 0e05820bd..53005653b 100644 --- a/resources/scripts/components/server/files/FileObjectRow.tsx +++ b/resources/scripts/components/server/files/FileObjectRow.tsx @@ -92,4 +92,11 @@ const FileObjectRow = ({ file }: { file: FileObject }) => ( ); -export default memo(FileObjectRow, isEqual); +export default memo(FileObjectRow, (prevProps, nextProps) => { + /* eslint-disable @typescript-eslint/no-unused-vars */ + const { isArchiveType, isEditable, ...prevFile } = prevProps.file; + const { isArchiveType: nextIsArchiveType, isEditable: nextIsEditable, ...nextFile } = nextProps.file; + /* eslint-enable @typescript-eslint/no-unused-vars */ + + return isEqual(prevFile, nextFile); +});