From f5f378d04b4ec775c53ea9fb40fcdd8c54aaee06 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Fri, 5 Jan 2024 20:25:56 +1100 Subject: [PATCH] fix(ui): revert back to lrumemoize --- .../src/app/store/createMemoizedSelector.ts | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/invokeai/frontend/web/src/app/store/createMemoizedSelector.ts b/invokeai/frontend/web/src/app/store/createMemoizedSelector.ts index 04dcf9d889..b4d46a4ef8 100644 --- a/invokeai/frontend/web/src/app/store/createMemoizedSelector.ts +++ b/invokeai/frontend/web/src/app/store/createMemoizedSelector.ts @@ -1,32 +1,33 @@ import { createDraftSafeSelectorCreator, createSelectorCreator, - weakMapMemoize, + lruMemoize, } from '@reduxjs/toolkit'; import type { GetSelectorsOptions } from '@reduxjs/toolkit/dist/entities/state_selectors'; +import { isEqual } from 'lodash-es'; /** * A memoized selector creator that uses LRU cache and lodash's isEqual for equality check. */ export const createMemoizedSelector = createSelectorCreator({ - memoize: weakMapMemoize, - // memoizeOptions: { - // resultEqualityCheck: isEqual, - // }, - argsMemoize: weakMapMemoize, + memoize: lruMemoize, + memoizeOptions: { + resultEqualityCheck: isEqual, + }, + argsMemoize: lruMemoize, }); /** * A memoized selector creator that uses LRU cache default shallow equality check. */ export const createLruSelector = createSelectorCreator({ - memoize: weakMapMemoize, - argsMemoize: weakMapMemoize, + memoize: lruMemoize, + argsMemoize: lruMemoize, }); export const createLruDraftSafeSelector = createDraftSafeSelectorCreator({ - memoize: weakMapMemoize, - argsMemoize: weakMapMemoize, + memoize: lruMemoize, + argsMemoize: lruMemoize, }); export const getSelectorsOptions: GetSelectorsOptions = {