From 14db7aa563d460574b6d17efbf008ec60962603c Mon Sep 17 00:00:00 2001 From: ChrisMattew Date: Fri, 20 Dec 2024 17:15:21 +0100 Subject: [PATCH] perf: improve spidLogin selectors --- ts/features/spidLogin/store/selectors/index.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ts/features/spidLogin/store/selectors/index.ts b/ts/features/spidLogin/store/selectors/index.ts index 9e4c53d55ff..5a9a9e14d72 100644 --- a/ts/features/spidLogin/store/selectors/index.ts +++ b/ts/features/spidLogin/store/selectors/index.ts @@ -1,7 +1,15 @@ +import { createSelector } from "reselect"; import { GlobalState } from "../../../../store/reducers/types"; -export const nativeLoginRequestInfoSelector = (state: GlobalState) => - state.features.loginFeatures.spidLogin.nativeLogin.requestInfo; +export const spidLoginSelector = (state: GlobalState) => + state.features.loginFeatures.spidLogin; -export const standardLoginRequestInfoSelector = (state: GlobalState) => - state.features.loginFeatures.spidLogin.standardLogin.requestInfo; +export const nativeLoginRequestInfoSelector = createSelector( + spidLoginSelector, + ({ nativeLogin }) => nativeLogin.requestInfo +); + +export const standardLoginRequestInfoSelector = createSelector( + spidLoginSelector, + ({ standardLogin }) => standardLogin.requestInfo +);