Skip to content

Commit b4ca0f7

Browse files
committed
review fixes
1 parent 8f6c812 commit b4ca0f7

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/components/CategorySelector/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Navigation from '@libs/Navigation/Navigation';
88
import CONST from '@src/CONST';
99
import {DYNAMIC_ROUTES} from '@src/ROUTES';
1010

11-
type CategorySelectorProps = {
11+
type CustomUnitDefaultCategorySelectorProps = {
1212
/** Currently selected category */
1313
defaultValue?: string;
1414

@@ -25,7 +25,7 @@ type CategorySelectorProps = {
2525
customUnitID: string;
2626
};
2727

28-
function CategorySelector({defaultValue = '', wrapperStyle, label, focused, customUnitID}: CategorySelectorProps) {
28+
function CustomUnitDefaultCategorySelector({defaultValue = '', wrapperStyle, label, focused, customUnitID}: CustomUnitDefaultCategorySelectorProps) {
2929
const styles = useThemeStyles();
3030

3131
const decodedCategoryName = getDecodedCategoryName(defaultValue);
@@ -49,4 +49,4 @@ function CategorySelector({defaultValue = '', wrapperStyle, label, focused, cust
4949
);
5050
}
5151

52-
export default CategorySelector;
52+
export default CustomUnitDefaultCategorySelector;

src/pages/workspace/categories/DynamicDefaultCategorySelectorPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import useDynamicBackPath from '@hooks/useDynamicBackPath';
77
import useLocalize from '@hooks/useLocalize';
88
import useOnyx from '@hooks/useOnyx';
99
import useThemeStyles from '@hooks/useThemeStyles';
10+
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
1011
import Navigation from '@libs/Navigation/Navigation';
1112
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
1213
import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
@@ -23,7 +24,7 @@ function DynamicDefaultCategorySelectorPage({route}: DynamicDefaultCategorySelec
2324
const {policyID, customUnitID} = route.params;
2425
const styles = useThemeStyles();
2526
const {translate} = useLocalize();
26-
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
27+
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(policyID)}`);
2728
const currentCategory = policy?.customUnits?.[customUnitID]?.defaultCategory ?? '';
2829
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.DEFAULT_CATEGORY_SELECTOR.path);
2930

src/pages/workspace/categories/DynamicSpendCategorySelectorPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {ListItem} from '@components/SelectionList/types';
66
import useDynamicBackPath from '@hooks/useDynamicBackPath';
77
import useOnyx from '@hooks/useOnyx';
88
import useThemeStyles from '@hooks/useThemeStyles';
9+
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
910
import Navigation from '@libs/Navigation/Navigation';
1011
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
1112
import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
@@ -23,7 +24,7 @@ function DynamicSpendCategorySelectorPage({route}: DynamicSpendCategorySelectorP
2324
const styles = useThemeStyles();
2425
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.SPEND_CATEGORY_SELECTOR.path);
2526

26-
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`);
27+
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(policyID)}`);
2728
const label = groupID.charAt(0).toUpperCase() + groupID.slice(1);
2829
const currentCategory = policy?.mccGroup?.[groupID]?.category ?? '';
2930

src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import {View} from 'react-native';
33
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView';
4-
import CategorySelector from '@components/CategorySelector';
4+
import CustomUnitDefaultCategorySelector from '@components/CategorySelector';
55
import HeaderWithBackButton from '@components/HeaderWithBackButton';
66
import OfflineWithFeedback from '@components/OfflineWithFeedback';
77
import RenderHTML from '@components/RenderHTML';
@@ -113,7 +113,7 @@ function PolicyDistanceRatesSettingsPage({route}: PolicyDistanceRatesSettingsPag
113113
errorRowStyles={styles.mh5}
114114
onClose={() => clearErrorFields('defaultCategory')}
115115
>
116-
<CategorySelector
116+
<CustomUnitDefaultCategorySelector
117117
label={translate('workspace.common.defaultCategory')}
118118
defaultValue={defaultCategory}
119119
wrapperStyle={[styles.ph5, styles.mt3]}

src/pages/workspace/perDiem/WorkspacePerDiemSettingsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import {View} from 'react-native';
33
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView';
4-
import CategorySelector from '@components/CategorySelector';
4+
import CustomUnitDefaultCategorySelector from '@components/CategorySelector';
55
import HeaderWithBackButton from '@components/HeaderWithBackButton';
66
import OfflineWithFeedback from '@components/OfflineWithFeedback';
77
import ScreenWrapper from '@components/ScreenWrapper';
@@ -73,7 +73,7 @@ function WorkspacePerDiemSettingsPage({route}: WorkspacePerDiemSettingsPageProps
7373
errorRowStyles={styles.mh5}
7474
onClose={() => clearErrorFields('defaultCategory')}
7575
>
76-
<CategorySelector
76+
<CustomUnitDefaultCategorySelector
7777
label={translate('workspace.common.defaultCategory')}
7878
defaultValue={defaultCategory}
7979
wrapperStyle={[styles.ph5, styles.mt3]}

0 commit comments

Comments
 (0)