Skip to content

Commit 64a251b

Browse files
authored
Merge pull request #5356 from bcgov/bug/5355
fix(5355): remove logic to set default value on edit page
2 parents 90f1e8f + 3f43feb commit 64a251b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/app/public-cloud/products/(product)/create/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ export default publicCloudProductNew(({}) => {
7171
label: 'Project budget',
7272
description: '',
7373
Component: Budget,
74-
componentArgs: {},
74+
componentArgs: {
75+
mode: 'create',
76+
},
7577
},
7678
];
7779

app/components/form/Budget.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import { useFormContext } from 'react-hook-form';
77
import ExternalLink from '@/components/generic/button/ExternalLink';
88
import FormDollarInput from '@/components/generic/input/FormDollarInput';
99
import HookFormDollarInput from '@/components/generic/input/HookFormDollarInput';
10-
import { cn } from '@/utils/js';
1110

12-
export default function Budget({ disabled }: { disabled?: boolean }) {
11+
export default function Budget({ disabled, mode }: { disabled?: boolean; mode?: 'create' | 'edit' }) {
1312
const {
1413
formState: { errors },
1514
setValue,
@@ -21,6 +20,8 @@ export default function Budget({ disabled }: { disabled?: boolean }) {
2120
const environmentsEnabled = watch('environmentsEnabled', {});
2221

2322
useEffect(() => {
23+
if (mode !== 'create') return;
24+
2425
['budget.dev', 'budget.test', 'budget.prod', 'budget.tools'].forEach((key) => {
2526
setValue(key, provider === Provider.AZURE ? 0 : 50, { shouldDirty: true });
2627
});

0 commit comments

Comments
 (0)