@centreon/ui 24.4.1-MON-21278-Delete-a-basic-token.6 → 24.4.1-MON-34415-package-centreon-web-debian-12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "24.4.1-MON-21278-Delete-a-basic-token.6",
3
+ "version": "24.4.1-MON-34415-package-centreon-web-debian-12.0",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -1,4 +1,4 @@
1
- import { ButtonProps, DialogContentText, Typography } from '@mui/material';
1
+ import { DialogContentText, Typography } from '@mui/material';
2
2
 
3
3
  import Dialog, { Props as DialogProps } from '..';
4
4
 
@@ -6,23 +6,15 @@ type Props = DialogProps & {
6
6
  children?: JSX.Element;
7
7
  labelMessage?: string | null;
8
8
  labelSecondMessage?: string | null;
9
- restCancelButtonProps?: ButtonProps;
10
- restConfirmButtonProps?: ButtonProps;
11
9
  };
12
10
 
13
11
  const Confirm = ({
14
12
  labelMessage,
15
13
  labelSecondMessage,
16
14
  children,
17
- restCancelButtonProps,
18
- restConfirmButtonProps,
19
15
  ...rest
20
16
  }: Props): JSX.Element => (
21
- <Dialog
22
- restCancelButtonProps={restCancelButtonProps}
23
- restConfirmButtonProps={restConfirmButtonProps}
24
- {...rest}
25
- >
17
+ <Dialog {...rest}>
26
18
  <DialogContentText>
27
19
  {labelMessage && <Typography>{labelMessage}</Typography>}
28
20
  {labelSecondMessage && <Typography>{labelSecondMessage}</Typography>}
@@ -9,8 +9,7 @@ import {
9
9
  DialogContent,
10
10
  DialogActions,
11
11
  DialogProps,
12
- CircularProgress,
13
- ButtonProps
12
+ CircularProgress
14
13
  } from '@mui/material';
15
14
 
16
15
  import { DataTestAttributes } from '../@types/data-attributes';
@@ -49,8 +48,6 @@ export type Props = {
49
48
  onClose?: () => void;
50
49
  onConfirm: (event, value?) => void;
51
50
  open: boolean;
52
- restCancelButtonProps?: ButtonProps;
53
- restConfirmButtonProps?: ButtonProps;
54
51
  submitting?: boolean;
55
52
  } & DialogProps &
56
53
  DataTestAttributes;
@@ -73,8 +70,6 @@ const Dialog = ({
73
70
  dialogContentClassName,
74
71
  dialogActionsClassName,
75
72
  dialogConfirmButtonClassName,
76
- restCancelButtonProps,
77
- restConfirmButtonProps,
78
73
  ...rest
79
74
  }: Props): JSX.Element => {
80
75
  const { classes, cx } = useStyles({ contentWidth });
@@ -106,7 +101,6 @@ const Dialog = ({
106
101
  data-testid="Cancel"
107
102
  disabled={cancelDisabled}
108
103
  onClick={onCancel}
109
- {...restCancelButtonProps}
110
104
  >
111
105
  {labelCancel}
112
106
  </Button>
@@ -119,7 +113,6 @@ const Dialog = ({
119
113
  disabled={confirmDisabled}
120
114
  endIcon={submitting && <CircularProgress size={15} />}
121
115
  onClick={onConfirm}
122
- {...restConfirmButtonProps}
123
116
  >
124
117
  {labelConfirm}
125
118
  </Button>
@@ -21,6 +21,7 @@ export interface UseFetchQueryProps<T> {
21
21
  catchError?: (props: CatchErrorProps) => void;
22
22
  decoder?: JsonDecoder.Decoder<T>;
23
23
  defaultFailureMessage?: string;
24
+ doNotCancelCallsOnUnmount?: boolean;
24
25
  fetchHeaders?: HeadersInit;
25
26
  getEndpoint: (params?: PrefetchEndpointParams) => string;
26
27
  getQueryKey: () => QueryKey;
@@ -59,7 +60,8 @@ const useFetchQuery = <T extends object>({
59
60
  isPaginated,
60
61
  queryOptions,
61
62
  httpCodesBypassErrorSnackbar = [],
62
- baseEndpoint
63
+ baseEndpoint,
64
+ doNotCancelCallsOnUnmount = false
63
65
  }: UseFetchQueryProps<T>): UseFetchQueryState<T> => {
64
66
  const dataRef = useRef<T | undefined>(undefined);
65
67
 
@@ -169,6 +171,10 @@ const useFetchQuery = <T extends object>({
169
171
 
170
172
  useEffect(() => {
171
173
  return (): void => {
174
+ if (doNotCancelCallsOnUnmount) {
175
+ return;
176
+ }
177
+
172
178
  queryClient.cancelQueries({ queryKey: getQueryKey() });
173
179
  };
174
180
  }, []);