Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/hooks/useAccountValidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;