mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
perf(ui): memoize layeractionsmenu valid actions
This commit is contained in:
parent
b7f9c5e221
commit
e936b1ff8f
@ -1,5 +1,5 @@
|
|||||||
import { Menu, MenuItem, MenuList } from '@invoke-ai/ui-library';
|
import { Menu, MenuItem, MenuList } from '@invoke-ai/ui-library';
|
||||||
import { createAppSelector } from 'app/store/createMemoizedSelector';
|
import { createMemoizedAppSelector } from 'app/store/createMemoizedSelector';
|
||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
import { CanvasEntityMenuButton } from 'features/controlLayers/components/common/CanvasEntityMenuButton';
|
import { CanvasEntityMenuButton } from 'features/controlLayers/components/common/CanvasEntityMenuButton';
|
||||||
import {
|
import {
|
||||||
@ -25,7 +25,7 @@ type Props = {
|
|||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectValidActions = createAppSelector([selectCanvasV2Slice, (canvasV2, id: string) => id], (canvasV2, id) => {
|
const selectValidActions = createMemoizedAppSelector([selectCanvasV2Slice, (canvasV2, id: string) => id], (canvasV2, id) => {
|
||||||
const layer = selectLayerOrThrow(canvasV2, id);
|
const layer = selectLayerOrThrow(canvasV2, id);
|
||||||
const layerIndex = canvasV2.layers.indexOf(layer);
|
const layerIndex = canvasV2.layers.indexOf(layer);
|
||||||
const layerCount = canvasV2.layers.length;
|
const layerCount = canvasV2.layers.length;
|
||||||
|
Loading…
Reference in New Issue
Block a user