From 78217f5ef96ef159fdf4710af2a153aee18f9e8d Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue, 22 Nov 2022 17:35:22 +1300 Subject: [PATCH] Fix unnecessary gallery re-renders --- frontend/src/features/gallery/components/ImageGallery.tsx | 1 - frontend/src/features/tabs/components/InvokeWorkarea.tsx | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/features/gallery/components/ImageGallery.tsx b/frontend/src/features/gallery/components/ImageGallery.tsx index a120ab4749..76f4abdc20 100644 --- a/frontend/src/features/gallery/components/ImageGallery.tsx +++ b/frontend/src/features/gallery/components/ImageGallery.tsx @@ -81,7 +81,6 @@ export default function ImageGallery() { shouldEnableResize, } = useAppSelector(imageGallerySelector); - console.log(isLightBoxOpen); const { galleryMinWidth, galleryMaxWidth } = isLightBoxOpen ? { galleryMinWidth: LIGHTBOX_GALLERY_WIDTH, diff --git a/frontend/src/features/tabs/components/InvokeWorkarea.tsx b/frontend/src/features/tabs/components/InvokeWorkarea.tsx index 1ca3da314a..ec6637cc61 100644 --- a/frontend/src/features/tabs/components/InvokeWorkarea.tsx +++ b/frontend/src/features/tabs/components/InvokeWorkarea.tsx @@ -10,6 +10,7 @@ import { setShowDualDisplay, } from 'features/options/store/optionsSlice'; import { setDoesCanvasNeedScaling } from 'features/canvas/store/canvasSlice'; +import _ from 'lodash'; const workareaSelector = createSelector( [(state: RootState) => state.options, activeTabNameSelector], @@ -21,6 +22,11 @@ const workareaSelector = createSelector( isLightBoxOpen, shouldShowDualDisplayButton: ['inpainting'].includes(activeTabName), }; + }, + { + memoizeOptions: { + resultEqualityCheck: _.isEqual, + }, } );