diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx
index cf9952720fc9..afde494a09d2 100644
--- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx
+++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx
@@ -201,15 +201,13 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) {
style={[isSmallScreenWidth && styles.flex1]}
/>
)}
- {policyTags && (
-
- )}
+
);
}
diff --git a/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx
index c479923098c2..1e9a73dcf136 100644
--- a/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx
+++ b/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx
@@ -3,6 +3,7 @@ import React, {useCallback, useMemo} from 'react';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
+import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
@@ -10,6 +11,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import Switch from '@components/Switch';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
+import useNetwork from '@hooks/useNetwork';
import useThemeStyles from '@hooks/useThemeStyles';
import * as Tag from '@libs/actions/Policy/Tag';
import Navigation from '@libs/Navigation/Navigation';
@@ -34,6 +36,8 @@ function WorkspaceTagsSettingsPage({route, policyTags}: WorkspaceTagsSettingsPag
const styles = useThemeStyles();
const {translate} = useLocalize();
const [policyTagLists, isMultiLevelTags] = useMemo(() => [PolicyUtils.getTagLists(policyTags), PolicyUtils.isMultiLevelTags(policyTags)], [policyTags]);
+ const isLoading = !PolicyUtils.getTagLists(policyTags)?.[0] || Object.keys(policyTags ?? {})[0] === 'undefined';
+ const {isOffline} = useNetwork();
const hasEnabledOptions = OptionsListUtils.hasEnabledOptions(Object.values(policyTags ?? {}).flatMap(({tags}) => Object.values(tags)));
const updateWorkspaceRequiresTag = useCallback(
(value: boolean) => {
@@ -42,6 +46,42 @@ function WorkspaceTagsSettingsPage({route, policyTags}: WorkspaceTagsSettingsPag
[policyID],
);
+ const getTagsSettings = (policy: OnyxEntry) => (
+
+
+
+
+ {translate('workspace.tags.requiresTag')}
+
+
+
+
+ {!isMultiLevelTags && (
+ Tag.clearPolicyTagListErrors(policyID, policyTagLists[0].orderWeight)}
+ pendingAction={policyTags?.[policyTagLists[0]?.name]?.pendingAction}
+ errorRowStyles={styles.mh5}
+ >
+ Navigation.navigate(ROUTES.WORKSPACE_EDIT_TAGS.getRoute(policyID, policyTagLists[0].orderWeight))}
+ shouldShowRightIcon
+ />
+
+ )}
+
+ );
return (
-
-
-
-
- {translate('workspace.tags.requiresTag')}
-
-
-
-
- {!isMultiLevelTags && (
- Tag.clearPolicyTagListErrors(policyID, policyTagLists[0].orderWeight)}
- pendingAction={policyTags?.[policyTagLists[0].name]?.pendingAction}
- errorRowStyles={styles.mh5}
- >
- Navigation.navigate(ROUTES.WORKSPACE_EDIT_TAGS.getRoute(policyID, policyTagLists[0].orderWeight))}
- shouldShowRightIcon
- />
-
- )}
-
+ {isOffline && isLoading ? {getTagsSettings(policy)} : getTagsSettings(policy)}
)}