From aeb8d748f019f7c64da628cd96a16a0137f81cb3 Mon Sep 17 00:00:00 2001 From: Anandaroop Roy Date: Thu, 21 Nov 2024 17:57:02 -0500 Subject: [PATCH] fix: code review suggestions Co-authored-by: Ole Co-authored-by: Mounir Dhahri --- src/app/utils/hooks/useIsDeepLink.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/app/utils/hooks/useIsDeepLink.ts b/src/app/utils/hooks/useIsDeepLink.ts index 363b1f99e74..65fc0bdd287 100644 --- a/src/app/utils/hooks/useIsDeepLink.ts +++ b/src/app/utils/hooks/useIsDeepLink.ts @@ -9,7 +9,7 @@ import { Linking } from "react-native" * * This can be used to avoid rendering content in previous screens in react-navigation history * - * @returns {isDeepLink: boolean | null} isDeepLink is true if the user came from a deep link + * @returns {isDeepLink: boolean | null}` isDeepLink` is true if the user came from a deep link. Initially, it is set to `null` while retrieving the deep link URL asynchronously and will be set to `false` if retrieving the `URL` fails. */ export const useIsDeepLink = () => { const [isDeepLink, setIsDeepLink] = useState(null) @@ -37,11 +37,7 @@ export const useIsDeepLink = () => { const isHomeLink = result.type === "match" && result.module === "Home" const shouldTreatAsDeepLink = !isHomeLink && !isExternalUrl - if (shouldTreatAsDeepLink) { - setIsDeepLink(true) - } else { - setIsDeepLink(false) - } + setIsDeepLink(shouldTreatAsDeepLink) }) .catch((error) => { console.error("Error getting initial URL", error)