Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4060,7 +4060,6 @@ function updateCustomRules(policyID: string, customRules: string) {
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
customRules: parsedCustomRules,
isLoading: true,
},
},
],
Expand All @@ -4073,7 +4072,6 @@ function updateCustomRules(policyID: string, customRules: string) {
// TODO
// maxExpenseAge: null,
},
isLoading: false,
},
},
],
Expand All @@ -4083,7 +4081,6 @@ function updateCustomRules(policyID: string, customRules: string) {
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
customRules: originalCustomRules,
isLoading: false,
// TODO
// pendingFields: {maxExpenseAge: null},
// errorFields: {maxExpenseAge: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('common.genericErrorMessage')},
Expand Down
10 changes: 2 additions & 8 deletions src/pages/workspace/rules/CustomRulesSection.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, {useMemo} from 'react';
import React from 'react';
import {View} from 'react-native';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import Section from '@components/Section';
import useLocalize from '@hooks/useLocalize';
import usePolicy from '@hooks/usePolicy';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import {getParsedComment} from '@libs/ReportUtils';
import ROUTES from '@src/ROUTES';

type CustomRulesSectionProps = {
Expand All @@ -17,12 +16,7 @@ function CustomRulesSection({policyID}: CustomRulesSectionProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const policy = usePolicy(policyID);
const parsedRules = useMemo(() => {
const customRules = policy?.customRules ?? '';
const options = policy?.isLoading ? {shouldEscapeText: false} : undefined;

return getParsedComment(customRules, options);
}, [policy]);
const parsedRules = policy?.customRules ?? '';
const rulesDescription = typeof parsedRules === 'string' ? parsedRules : '';

return (
Expand Down