From 94f423812b66a0963548fd8df184293cb24d22c3 Mon Sep 17 00:00:00 2001 From: Siarhei Karol Date: Thu, 12 Dec 2024 11:29:30 +0300 Subject: [PATCH] comments updated --- src/store/selectors.ts | 4 ++-- src/store/utils/selectors.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/selectors.ts b/src/store/selectors.ts index 0f1bfe6..0282941 100644 --- a/src/store/selectors.ts +++ b/src/store/selectors.ts @@ -7,8 +7,8 @@ import { useConfigStore } from './stores/config'; import { useUIStore } from './stores/ui'; import { useSearchStore } from './stores/search'; -// "createSelectors" can be used here for generation of the memoized selectors. -// Now this function is non-optimized and its usage causes memory leaks. +// The "createSelectors" function can be utilized here to generate memoized selectors +// Note: "createSelectors" is currently unoptimized and may result in memory leaks if used as is export const useStatusState = useStatusStore; export const useLoadingState = useLoadingStateStore; export const useMarcPreviewState = useMarcPreviewStore; diff --git a/src/store/utils/selectors.ts b/src/store/utils/selectors.ts index 11e235c..2994f67 100644 --- a/src/store/utils/selectors.ts +++ b/src/store/utils/selectors.ts @@ -6,8 +6,8 @@ type WithSelectors = S extends { ? S & { use: { [K in keyof T]: T[K] } } : never; -// Use this function to generate all available selectors. -// Now it causes memory leaks if invoke it after each re-render, so it should be memoized. +// Use this function to generate all available selectors +// Currently, invoking it after each re-render leads to memory leaks, so it should be memoized to prevent this issue export const createSelectors = >>(_store: S) => { const store = _store as WithSelectors; store.use = {};