Skip to content

Commit d32ae1e

Browse files
author
Zabilsya
committed
[DOP-22361] fix after review
1 parent 1928e75 commit d32ae1e

File tree

3 files changed

+8
-7
lines changed
  • src
    • entities/transformation/ui/FilterRows
    • features/transfer/MutateTransferForm/components/TransferConnectionsCanvas/utils/getInitialEdges
    • shared/ui/CronSelect/hooks/useCron

3 files changed

+8
-7
lines changed

src/entities/transformation/ui/FilterRows/index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import { Button, Form } from 'antd';
22
import React, { memo, useLayoutEffect } from 'react';
33

4-
import { TransformationRowsFilter, TransformationType } from '../../types';
4+
import { Transformations, TransformationType } from '../../types';
55

66
import { FilterRowsItem } from './components';
77

88
export const FilterRows = memo(() => {
99
const formInstance = Form.useFormInstance();
10-
const filterRowsValues: TransformationRowsFilter['filters'] | undefined = formInstance.getFieldValue([
10+
const filterRowsValues: Transformations[0]['filters'] | undefined = formInstance.getFieldValue([
1111
'transformations',
1212
TransformationType.ROWS_FILTER,
1313
]);
1414

15-
/** Add at least one element to array form value */
15+
/** Add at least one element to array form value here,
16+
* because it is inconvenient to check for the presence of a default value of this array,
17+
* when forming a request to backend or initial form values */
1618
useLayoutEffect(() => {
1719
if (!filterRowsValues || !filterRowsValues.length) {
18-
formInstance.setFieldValue(
19-
['transformations', TransformationType.ROWS_FILTER],
20-
[{ column: '', type: undefined }],
21-
);
20+
formInstance.setFieldValue(['transformations', TransformationType.ROWS_FILTER], [{}]);
2221
}
2322
}, [formInstance, filterRowsValues]);
2423

src/features/transfer/MutateTransferForm/components/TransferConnectionsCanvas/utils/getInitialEdges/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { TransferCanvasNodeData } from '../../types';
55
export const getInitialEdges = (nodes: TransferCanvasNodeData[]): Edge[] => {
66
const edges: Edge[] = [];
77

8+
/** for instead of Array.prototype.map, because we need to skip first element */
89
for (let i = 1; i < nodes.length; i++) {
910
edges.push({
1011
id: `edge-${i}`,

src/shared/ui/CronSelect/hooks/useCron/useCron.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const useCron = ({ value, onChange = () => undefined }: UseCronProps) =>
1313
/** Invoke onChange callback to set default value to antd Form if not specified */
1414
useEffect(() => {
1515
handleChange();
16+
/** Disable eslint, because need to invoke useEffect only after mounting */
1617
// eslint-disable-next-line react-hooks/exhaustive-deps
1718
}, []);
1819

0 commit comments

Comments
 (0)