From d3133b899a105a17469d60ed5977d9b9204d6c26 Mon Sep 17 00:00:00 2001 From: MartinCupela <32706194+MartinCupela@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:36:36 +0200 Subject: [PATCH] refactor: apply suggestions about declaring state selector Co-authored-by: Anton Arnautov <43254280+arnautov-anton@users.noreply.github.com> --- src/components/Dialog/hooks/useDialog.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Dialog/hooks/useDialog.ts b/src/components/Dialog/hooks/useDialog.ts index 9fc293b12..8824ad787 100644 --- a/src/components/Dialog/hooks/useDialog.ts +++ b/src/components/Dialog/hooks/useDialog.ts @@ -20,10 +20,10 @@ export const useDialog = ({ id }: GetOrCreateDialogParams) => { export const useDialogIsOpen = (id: string) => { const { dialogManager } = useDialogManager(); const dialogIsOpenSelector = useCallback( - ({ dialogsById }: DialogManagerState) => [!!dialogsById[id]?.isOpen], + ({ dialogsById }: DialogManagerState) => [!!dialogsById[id]?.isOpen] as const, [id], ); - return useStateStore(dialogManager.state, dialogIsOpenSelector)[0]; + return useStateStore(dialogManager.state, dialogIsOpenSelector)[0]; }; const openedDialogCountSelector = (nextValue: DialogManagerState) => [ @@ -31,11 +31,11 @@ const openedDialogCountSelector = (nextValue: DialogManagerState) => [ if (dialog.isOpen) return count + 1; return count; }, 0), -]; +] as const; export const useOpenedDialogCount = () => { const { dialogManager } = useDialogManager(); - return useStateStore( + return useStateStore( dialogManager.state, openedDialogCountSelector, )[0];