mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
perf(ui): fix rerenders in nodes
Unmemoized selector tanking perf
This commit is contained in:
parent
b508945b11
commit
7a92afc117
@ -1,5 +1,5 @@
|
|||||||
import { createSelector } from '@reduxjs/toolkit';
|
|
||||||
import { EMPTY_ARRAY } from 'app/store/constants';
|
import { EMPTY_ARRAY } from 'app/store/constants';
|
||||||
|
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import { selectNodesSlice } from 'features/nodes/store/nodesSlice';
|
import { selectNodesSlice } from 'features/nodes/store/nodesSlice';
|
||||||
import { selectNodeTemplate } from 'features/nodes/store/selectors';
|
import { selectNodeTemplate } from 'features/nodes/store/selectors';
|
||||||
@ -10,7 +10,7 @@ import { useMemo } from 'react';
|
|||||||
export const useOutputFieldNames = (nodeId: string) => {
|
export const useOutputFieldNames = (nodeId: string) => {
|
||||||
const selector = useMemo(
|
const selector = useMemo(
|
||||||
() =>
|
() =>
|
||||||
createSelector(selectNodesSlice, (nodes) => {
|
createMemoizedSelector(selectNodesSlice, (nodes) => {
|
||||||
const template = selectNodeTemplate(nodes, nodeId);
|
const template = selectNodeTemplate(nodes, nodeId);
|
||||||
if (!template) {
|
if (!template) {
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
|
Loading…
Reference in New Issue
Block a user