From 7a92afc1177719d64a6a4b7d4940b93d1275c217 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 15 Apr 2024 22:22:25 +1000 Subject: [PATCH] perf(ui): fix rerenders in nodes Unmemoized selector tanking perf --- .../web/src/features/nodes/hooks/useOutputFieldNames.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts b/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts index e16b329c22..54c092370b 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useOutputFieldNames.ts @@ -1,5 +1,5 @@ -import { createSelector } from '@reduxjs/toolkit'; import { EMPTY_ARRAY } from 'app/store/constants'; +import { createMemoizedSelector } from 'app/store/createMemoizedSelector'; import { useAppSelector } from 'app/store/storeHooks'; import { selectNodesSlice } from 'features/nodes/store/nodesSlice'; import { selectNodeTemplate } from 'features/nodes/store/selectors'; @@ -10,7 +10,7 @@ import { useMemo } from 'react'; export const useOutputFieldNames = (nodeId: string) => { const selector = useMemo( () => - createSelector(selectNodesSlice, (nodes) => { + createMemoizedSelector(selectNodesSlice, (nodes) => { const template = selectNodeTemplate(nodes, nodeId); if (!template) { return EMPTY_ARRAY;