feat(ui): memoize NextPrevImageButtons component

This was rerendering on every progress image, now it doesn't
This commit is contained in:
psychedelicious 2023-07-10 11:22:34 +10:00
parent 265996d230
commit a7b8109ac2

View File

@ -8,7 +8,7 @@ import {
selectImagesById, selectImagesById,
} from 'features/gallery/store/gallerySlice'; } from 'features/gallery/store/gallerySlice';
import { clamp, isEqual } from 'lodash-es'; import { clamp, isEqual } from 'lodash-es';
import { useCallback, useState } from 'react'; import { memo, useCallback, useState } from 'react';
import { useHotkeys } from 'react-hotkeys-hook'; import { useHotkeys } from 'react-hotkeys-hook';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { FaAngleDoubleRight, FaAngleLeft, FaAngleRight } from 'react-icons/fa'; import { FaAngleDoubleRight, FaAngleLeft, FaAngleRight } from 'react-icons/fa';
@ -227,4 +227,4 @@ const NextPrevImageButtons = () => {
); );
}; };
export default NextPrevImageButtons; export default memo(NextPrevImageButtons);