Skip to content

Commit d8b1c91

Browse files
authored
Fix/clear on close type (#540)
Signed-off-by: capyq <[email protected]> Signed-off-by: Thang PHAM <[email protected]>
1 parent 9f3c202 commit d8b1c91

14 files changed

+46
-49
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependencies": {
88
"@emotion/react": "^11.11.4",
99
"@emotion/styled": "^11.11.5",
10-
"@gridsuite/commons-ui": "0.71.1",
10+
"@gridsuite/commons-ui": "0.72.0",
1111
"@hookform/resolvers": "^3.3.4",
1212
"@mui/icons-material": "^5.15.14",
1313
"@mui/lab": "5.0.0-alpha.169",

src/components/dialogs/contingency-list/creation/contingency-list-creation-dialog.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
} from '@gridsuite/commons-ui';
1616
import { useForm } from 'react-hook-form';
1717
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
18-
import { SyntheticEvent } from 'react';
1918
import { createContingencyList } from '../../../../utils/rest-api';
2019
import ContingencyListCreationForm from './contingency-list-creation-form';
2120
import {
@@ -47,7 +46,7 @@ const schema = yup.object().shape({
4746
const emptyFormData = getContingencyListEmptyFormData();
4847

4948
export interface ContingencyListCreationDialogProps {
50-
onClose: (event?: SyntheticEvent) => void;
49+
onClose: () => void;
5150
open: boolean;
5251
titleId: string;
5352
}
@@ -75,9 +74,9 @@ export default function ContingencyListCreationDialog({
7574
const nameError = errors[FieldConstants.NAME];
7675
const isValidating = errors.root?.isValidating;
7776

78-
const closeAndClear = (event?: SyntheticEvent) => {
77+
const closeAndClear = () => {
7978
reset(emptyFormData);
80-
onClose(event);
79+
onClose();
8180
};
8281

8382
const onSubmit = (data: ContingencyListFormDataWithRequiredCriteria) => {

src/components/dialogs/contingency-list/edition/criteria-based/criteria-based-edition-dialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@gridsuite/commons-ui';
1616
import { useForm } from 'react-hook-form';
1717
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
18-
import { SyntheticEvent, useEffect, useState } from 'react';
18+
import { useEffect, useState } from 'react';
1919
import { getContingencyList, saveCriteriaBasedContingencyList } from 'utils/rest-api';
2020
import { useDispatch, useSelector } from 'react-redux';
2121
import { AppState } from '../../../../../redux/types';
@@ -41,7 +41,7 @@ export interface CriteriaBasedEditionDialogProps {
4141
contingencyListId: string;
4242
contingencyListType: string;
4343
open: boolean;
44-
onClose: (event?: SyntheticEvent) => void;
44+
onClose: () => void;
4545
titleId: string;
4646
name: string;
4747
broadcastChannel: BroadcastChannel;
@@ -92,9 +92,9 @@ export default function CriteriaBasedEditionDialog({
9292
.finally(() => setIsFetching(false));
9393
}, [contingencyListId, contingencyListType, name, reset, snackError]);
9494

95-
const closeAndClear = (event?: SyntheticEvent) => {
95+
const closeAndClear = () => {
9696
reset(emptyFormData());
97-
onClose(event);
97+
onClose();
9898
};
9999

100100
const onSubmit = (contingencyList: CriteriaBasedEditionFormData) => {

src/components/dialogs/contingency-list/edition/explicit-naming/explicit-naming-edition-dialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from '@gridsuite/commons-ui';
1515
import { useForm } from 'react-hook-form';
1616
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
17-
import { SyntheticEvent, useEffect, useState } from 'react';
17+
import { useEffect, useState } from 'react';
1818
import { getContingencyList, saveExplicitNamingContingencyList } from 'utils/rest-api';
1919
import { prepareContingencyListForBackend } from 'components/dialogs/contingency-list-helper';
2020
import { useDispatch, useSelector } from 'react-redux';
@@ -48,7 +48,7 @@ export interface ExplicitNamingEditionDialogProps {
4848
contingencyListId: string;
4949
contingencyListType: string;
5050
open: boolean;
51-
onClose: (event?: SyntheticEvent) => void;
51+
onClose: () => void;
5252
titleId: string;
5353
name: string;
5454
broadcastChannel: BroadcastChannel;
@@ -97,9 +97,9 @@ export default function ExplicitNamingEditionDialog({
9797
.finally(() => setIsFetching(false));
9898
}, [contingencyListId, contingencyListType, name, reset, snackError]);
9999

100-
const closeAndClear = (event?: SyntheticEvent) => {
100+
const closeAndClear = () => {
101101
reset(emptyFormData());
102-
onClose(event);
102+
onClose();
103103
};
104104

105105
const editContingencyList = (contingencyListId2: string, contingencyList: ExplicitNamingEditionFormData) => {

src/components/dialogs/contingency-list/edition/script/script-edition-dialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from '@gridsuite/commons-ui';
1515
import { useForm } from 'react-hook-form';
1616
import { yupResolver } from '@hookform/resolvers/yup/dist/yup';
17-
import { SyntheticEvent, useEffect, useState } from 'react';
17+
import { useEffect, useState } from 'react';
1818
import { getContingencyList, saveScriptContingencyList } from 'utils/rest-api';
1919
import { useDispatch, useSelector } from 'react-redux';
2020
import { getContingencyListEmptyFormData, getScriptFormDataFromFetchedElement } from '../../contingency-list-utils';
@@ -40,7 +40,7 @@ export interface ScriptEditionDialogProps {
4040
contingencyListId: string;
4141
contingencyListType: string;
4242
open: boolean;
43-
onClose: (event?: SyntheticEvent) => void;
43+
onClose: () => void;
4444
titleId: string;
4545
name: string;
4646
broadcastChannel: BroadcastChannel;
@@ -91,9 +91,9 @@ export default function ScriptEditionDialog({
9191
.finally(() => setIsFetching(false));
9292
}, [contingencyListId, contingencyListType, name, reset, snackError]);
9393

94-
const closeAndClear = (event?: SyntheticEvent) => {
94+
const closeAndClear = () => {
9595
reset(emptyFormData());
96-
onClose(event);
96+
onClose();
9797
};
9898

9999
const editContingencyList = (contingencyListId2: string, contingencyList: ScriptEditionFormData) => {

src/components/dialogs/copy-to-script-dialog.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const emptyFormData = {
2626
export interface CopyToScriptDialogProps {
2727
id: string;
2828
open: boolean;
29-
onClose: (...args: any[]) => void;
29+
onClose: () => void;
3030
onValidate: (...args: any[]) => void;
3131
currentName: string;
3232
title: string;
@@ -83,10 +83,6 @@ export default function CopyToScriptDialog({
8383
onValidate(id, data[FieldConstants.NAME]);
8484
};
8585

86-
const handleClose = () => {
87-
onClose();
88-
};
89-
9086
const handleGenerateNameError = useCallback(
9187
() => handleError(intl.formatMessage({ id: 'generateCopyScriptNameError' }, { itemName: currentName })),
9288
[currentName, handleError, intl]
@@ -112,7 +108,7 @@ export default function CopyToScriptDialog({
112108
return (
113109
<CustomMuiDialog
114110
open={open}
115-
onClose={handleClose}
111+
onClose={onClose}
116112
onSave={onSubmit}
117113
formSchema={schema}
118114
formMethods={methods}

src/components/dialogs/create-case-dialog/create-case-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface IFormData {
4141
}
4242

4343
export interface CreateCaseDialogProps {
44-
onClose: (e?: unknown, nextSelectedDirectoryId?: string | null) => void;
44+
onClose: () => void;
4545
open: boolean;
4646
}
4747

src/components/dialogs/create-directory-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useNameField } from './field-hook';
1414

1515
export interface CreateDirectoryDialogProps {
1616
open: boolean;
17-
onClose: (e?: unknown, nextSelectedDirectoryId?: string | null) => void;
17+
onClose: () => void;
1818
onClick: (newName: string) => void;
1919
title: string;
2020
parentDirectory?: UUID;

src/components/dialogs/create-study-dialog/create-study-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function formatCaseImportParameters(params: Parameter[]): Parameter[] {
6464

6565
export interface CreateStudyDialogProps {
6666
open: boolean;
67-
onClose: (e?: unknown, nextSelectedDirectoryId?: string | null) => void;
67+
onClose: () => void;
6868
providedExistingCase?: ElementAttributes;
6969
}
7070

0 commit comments

Comments
 (0)