Skip to content

Commit ec823bf

Browse files
authored
perf: remove strict mode wrapper and react version check (#43)
1 parent 1148216 commit ec823bf

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

.storybook/decorators/withTheme.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import '@gravity-ui/uikit/styles/styles.scss';
88
import './styles.scss';
99

1010
export const withTheme: DecoratorFn = (Story, context) => (
11-
<React.StrictMode>
12-
<ThemeProvider theme={context.globals.theme}>
13-
<Story {...context} />
14-
</ThemeProvider>
15-
</React.StrictMode>
11+
<ThemeProvider theme={context.globals.theme}>
12+
<Story {...context} />
13+
</ThemeProvider>
1614
);

src/lib/core/components/Form/hooks/useField.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22

33
import _ from 'lodash';
44

5-
import {isArraySpec, isNumberSpec, isObjectSpec, isReact18OrMore} from '../../../helpers';
5+
import {isArraySpec, isNumberSpec, isObjectSpec} from '../../../helpers';
66
import {Spec} from '../../../types';
77
import {OBJECT_ARRAY_CNT, OBJECT_ARRAY_FLAG, REMOVED_ITEM} from '../constants';
88
import {
@@ -255,10 +255,6 @@ export const useField = <Value extends FieldValue, SpecType extends Spec>({
255255
firstRenderRef.current = false;
256256

257257
return () => {
258-
if (isReact18OrMore()) {
259-
firstRenderRef.current = true;
260-
}
261-
262258
(parentOnUnmount ? parentOnUnmount : tools.onUnmount)(name);
263259
};
264260
}, []);

src/lib/core/components/Form/hooks/useStore.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import _ from 'lodash';
44
import {useForm} from 'react-final-form';
55

6-
import {isReact18OrMore} from '../../../helpers';
76
import {DynamicFieldStore, FieldObjectValue, FieldValue, ValidateError} from '../types';
87
import {transformArrIn} from '../utils';
98

@@ -65,12 +64,6 @@ export const useStore = (name: string) => {
6564

6665
React.useEffect(() => {
6766
firstRenderRef.current = false;
68-
69-
return () => {
70-
if (isReact18OrMore()) {
71-
firstRenderRef.current = true;
72-
}
73-
};
7467
}, []);
7568

7669
return {tools, store};

src/lib/core/helpers.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from 'react';
2-
31
import _ from 'lodash';
42

53
import {SpecTypes} from './constants';
@@ -29,5 +27,3 @@ export const isObjectSpec = (candidate: any): candidate is ObjectSpec =>
2927

3028
export const isStringSpec = (candidate: any): candidate is StringSpec =>
3129
candidate?.type === SpecTypes.String;
32-
33-
export const isReact18OrMore = () => Number(React.version.split('.')[0]) >= 18;

0 commit comments

Comments
 (0)