Skip to content

Commit e655e9e

Browse files
committed
fix: [PROD-11887] clearing errors in table edit no longer causes dirty state
1 parent 72a4512 commit e655e9e

File tree

1 file changed

+11
-2
lines changed
  • src/components/ScenarioParameters/components/ScenarioParametersInputs

1 file changed

+11
-2
lines changed

src/components/ScenarioParameters/components/ScenarioParametersInputs/GenericTable.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { AgGridUtils, FileBlobUtils } from '@cosmotech/core';
99
import { useTranslation } from 'react-i18next';
1010
import PropTypes from 'prop-types';
1111
import { useSelector } from 'react-redux';
12+
import { useFormContext } from 'react-hook-form';
13+
1214
import { TableExportDialog } from './components';
1315
import { gridLight, gridDark } from '../../../../theme/';
1416
import { ConfigUtils, TranslationUtils, FileManagementUtils } from '../../../../utils';
@@ -49,6 +51,9 @@ export const GenericTable = ({
4951
isDirty,
5052
}) => {
5153
const { t } = useTranslation();
54+
55+
const { resetField } = useFormContext();
56+
5257
const organizationId = useOrganizationId();
5358
const workspaceId = useWorkspaceId();
5459
const datasets = useSelector((state) => state.dataset?.list?.data);
@@ -439,8 +444,12 @@ export const GenericTable = ({
439444
const onCellChange = updateOnFirstEdition;
440445

441446
const onClearErrors = () => {
442-
updateParameterValue({
443-
errors: null,
447+
resetField(parameterId, {
448+
keepError: false,
449+
defaultValue: {
450+
...parameterValue,
451+
errors: null,
452+
},
444453
});
445454
};
446455

0 commit comments

Comments
 (0)