From 466b285b174f9d3c5ed3ed7c53710654fd69dc17 Mon Sep 17 00:00:00 2001 From: Adam Grzybowski Date: Wed, 4 Dec 2024 16:45:01 +0100 Subject: [PATCH] fix useActiveWorkspaceFromNavigationState --- src/hooks/useActiveWorkspaceFromNavigationState.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useActiveWorkspaceFromNavigationState.ts b/src/hooks/useActiveWorkspaceFromNavigationState.ts index d2851e83ab6c..0308ece138a6 100644 --- a/src/hooks/useActiveWorkspaceFromNavigationState.ts +++ b/src/hooks/useActiveWorkspaceFromNavigationState.ts @@ -18,10 +18,10 @@ function useActiveWorkspaceFromNavigationState() { Log.warn('useActiveWorkspaceFromNavigationState should be called only from BottomTab screens'); } - const params = state.routes.at(-1)?.params ?? {}; + const lastHomeParams = state.routes.findLast((route) => route.name === SCREENS.HOME)?.params ?? {}; - if ('policyID' in params) { - return params?.policyID; + if ('policyID' in lastHomeParams) { + return lastHomeParams.policyID; } });