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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import Switch from '@components/Switch';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import usePrevious from '@hooks/usePrevious';
import useThemeStyles from '@hooks/useThemeStyles';
import * as ReportField from '@libs/actions/Policy/ReportField';
import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -58,18 +59,17 @@ function ReportFieldsValueSettingsPage({
}, [formDraft?.disabledListValues, formDraft?.listValues, policy?.fieldList, reportFieldID, valueIndex]);

const hasAccountingConnections = PolicyUtils.hasAccountingConnections(policy);
const oldValueName = usePrevious(currentValueName);
Comment thread
nkdengineer marked this conversation as resolved.

if (!currentValueName || hasAccountingConnections) {
if ((!currentValueName && !oldValueName) || hasAccountingConnections) {
return <NotFoundPage />;
}

const deleteListValueAndHideModal = () => {
if (reportFieldID) {
ReportField.removeReportFieldListValue(policyID, reportFieldID, [valueIndex]);
} else {
ReportField.deleteReportFieldsListValue([valueIndex]);
}

setIsDeleteTagModalOpen(false);
Navigation.goBack();
};
Expand Down Expand Up @@ -99,7 +99,7 @@ function ReportFieldsValueSettingsPage({
testID={ReportFieldsValueSettingsPage.displayName}
>
<HeaderWithBackButton
title={currentValueName}
title={currentValueName ?? oldValueName}
shouldSetModalVisibility={false}
/>
<ConfirmModal
Expand All @@ -125,7 +125,7 @@ function ReportFieldsValueSettingsPage({
</View>
</View>
<MenuItemWithTopDescription
title={currentValueName}
title={currentValueName ?? oldValueName}
description={translate('common.value')}
shouldShowRightIcon={!reportFieldID}
interactive={!reportFieldID}
Expand Down