Fix unnecessary gallery re-renders

This commit is contained in:
blessedcoolant 2022-11-22 17:35:22 +13:00
parent c6112e3295
commit 78217f5ef9
2 changed files with 6 additions and 1 deletions

View File

@ -81,7 +81,6 @@ export default function ImageGallery() {
shouldEnableResize,
} = useAppSelector(imageGallerySelector);
console.log(isLightBoxOpen);
const { galleryMinWidth, galleryMaxWidth } = isLightBoxOpen
? {
galleryMinWidth: LIGHTBOX_GALLERY_WIDTH,

View File

@ -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,
},
}
);