Skip to content

Commit 908ef32

Browse files
committed
bring back seeding from saved values
1 parent f2e24cb commit 908ef32

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/pages/workspace/categories/DynamicExpenseLimitTypeSelectorPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ type DynamicExpenseLimitTypeSelectorPageProps = PlatformStackScreenProps<Setting
2323

2424
function DynamicExpenseLimitTypeSelectorPage({
2525
route: {
26-
params: {policyID},
26+
params: {policyID, categoryName},
2727
},
2828
}: DynamicExpenseLimitTypeSelectorPageProps) {
2929
const styles = useThemeStyles();
3030
const {translate} = useLocalize();
3131
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.EXPENSE_LIMIT_TYPE_SELECTOR.path);
3232
const [formDraft] = useOnyx(ONYXKEYS.FORMS.WORKSPACE_CATEGORY_FLAG_AMOUNTS_OVER_FORM_DRAFT);
33+
const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`);
3334

34-
const currentExpenseLimitType = formDraft?.expenseLimitType ?? CONST.POLICY.EXPENSE_LIMIT_TYPES.EXPENSE;
35+
const currentExpenseLimitType = formDraft?.expenseLimitType ?? policyCategories?.[categoryName]?.expenseLimitType ?? CONST.POLICY.EXPENSE_LIMIT_TYPES.EXPENSE;
3536

3637
const expenseLimitTypes = Object.values(CONST.POLICY.EXPENSE_LIMIT_TYPES).map((value) => ({
3738
value,

0 commit comments

Comments
 (0)