diff --git a/src/CONST.ts b/src/CONST.ts index 9db98b52d537..84b393a1f5ae 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -243,10 +243,6 @@ const CONST = { OLD_DOT_ANDROID: 'https://play.google.com/store/apps/details?id=org.me.mobiexpensifyg&hl=en_US&pli=1', OLD_DOT_IOS: 'https://apps.apple.com/us/app/expensify-expense-tracker/id471713959', }, - ONYX_FETCH_STATUS: { - LOADING: 'loading', - LOADED: 'loaded', - }, DATE: { SQL_DATE_TIME: 'YYYY-MM-DD HH:mm:ss', FNS_FORMAT_STRING: 'yyyy-MM-dd', diff --git a/src/libs/Navigation/OnyxTabNavigator.tsx b/src/libs/Navigation/OnyxTabNavigator.tsx index 001cd795f376..c691f740fd56 100644 --- a/src/libs/Navigation/OnyxTabNavigator.tsx +++ b/src/libs/Navigation/OnyxTabNavigator.tsx @@ -9,10 +9,10 @@ import type {TabSelectorProps} from '@components/TabSelector/TabSelector'; import useThemeStyles from '@hooks/useThemeStyles'; import type {IOURequestType} from '@libs/actions/IOU'; import Tab from '@userActions/Tab'; -import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {SelectedTabRequest} from '@src/types/onyx'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; import {defaultScreenOptions} from './OnyxTabNavigatorConfig'; type OnyxTabNavigatorProps = ChildrenProps & { @@ -66,7 +66,7 @@ function OnyxTabNavigator({ }: OnyxTabNavigatorProps) { // Mapping of tab name to focus trap container element const [focusTrapContainerElementMapping, setFocusTrapContainerElementMapping] = useState>({}); - const [selectedTab, {status: onyxFetchStatus}] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${id}`); + const [selectedTab, onyxFetchMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${id}`); // This callback is used to register the focus trap container element of each avaiable tab screen const setTabFocusTrapContainerElement = useCallback((tabName: string, containerElement: HTMLElement | null) => { @@ -103,7 +103,7 @@ function OnyxTabNavigator({ onActiveTabFocusTrapContainerElementChanged?.(selectedTab ? focusTrapContainerElementMapping[selectedTab] : null); }, [selectedTab, focusTrapContainerElementMapping, onActiveTabFocusTrapContainerElementChanged]); - if (onyxFetchStatus === CONST.ONYX_FETCH_STATUS.LOADING) { + if (isLoadingOnyxValue(onyxFetchMetadata)) { return null; }