Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Not here page appears briefly after deleting the list value #48045

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Changes from 1 commit
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);
nkdengineer marked this conversation as resolved.
Show resolved Hide 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
Loading