From 59453e4fdb3d4ca62eac050cc67f06ef49f253ca Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 25 Apr 2025 23:13:33 +0800 Subject: [PATCH] fallback to user validated property if the account isn't available --- src/hooks/useAccountValidation.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hooks/useAccountValidation.tsx b/src/hooks/useAccountValidation.tsx index ef67cfe70014..74f0ad3fe998 100644 --- a/src/hooks/useAccountValidation.tsx +++ b/src/hooks/useAccountValidation.tsx @@ -4,11 +4,10 @@ import ONYXKEYS from '@src/ONYXKEYS'; // TODO: Remove/Update this hook once we remove the user data and migrate to account data in https://github.com/Expensify/App/issues/59277 function useAccountValidation() { // Some places are using the current value to compare, so we shouldn't cast to boolean - const [isAccountValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.validated}); - const [isUserValidated] = useOnyx(ONYXKEYS.USER, {selector: (user) => user?.validated}); + const [isAccountValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.validated, canBeMissing: true}); + const [isUserValidated] = useOnyx(ONYXKEYS.USER, {selector: (user) => user?.validated, canBeMissing: true}); - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - return isAccountValidated || isUserValidated; + return isAccountValidated ?? isUserValidated; } export default useAccountValidation;