diff --git a/.storybook/decorators/withTheme.tsx b/.storybook/decorators/withTheme.tsx index 513635a6..69eebfb0 100644 --- a/.storybook/decorators/withTheme.tsx +++ b/.storybook/decorators/withTheme.tsx @@ -8,9 +8,7 @@ import '@gravity-ui/uikit/styles/styles.scss'; import './styles.scss'; export const withTheme: DecoratorFn = (Story, context) => ( - - - - - + + + ); diff --git a/src/lib/core/components/Form/hooks/useField.tsx b/src/lib/core/components/Form/hooks/useField.tsx index 0fe3a74e..d3a01f01 100644 --- a/src/lib/core/components/Form/hooks/useField.tsx +++ b/src/lib/core/components/Form/hooks/useField.tsx @@ -2,7 +2,7 @@ import React from 'react'; import _ from 'lodash'; -import {isArraySpec, isNumberSpec, isObjectSpec, isReact18OrMore} from '../../../helpers'; +import {isArraySpec, isNumberSpec, isObjectSpec} from '../../../helpers'; import {Spec} from '../../../types'; import {OBJECT_ARRAY_CNT, OBJECT_ARRAY_FLAG, REMOVED_ITEM} from '../constants'; import { @@ -255,10 +255,6 @@ export const useField = ({ firstRenderRef.current = false; return () => { - if (isReact18OrMore()) { - firstRenderRef.current = true; - } - (parentOnUnmount ? parentOnUnmount : tools.onUnmount)(name); }; }, []); diff --git a/src/lib/core/components/Form/hooks/useStore.tsx b/src/lib/core/components/Form/hooks/useStore.tsx index 9c3782f4..c954606b 100644 --- a/src/lib/core/components/Form/hooks/useStore.tsx +++ b/src/lib/core/components/Form/hooks/useStore.tsx @@ -3,7 +3,6 @@ import React from 'react'; import _ from 'lodash'; import {useForm} from 'react-final-form'; -import {isReact18OrMore} from '../../../helpers'; import {DynamicFieldStore, FieldObjectValue, FieldValue, ValidateError} from '../types'; import {transformArrIn} from '../utils'; @@ -65,12 +64,6 @@ export const useStore = (name: string) => { React.useEffect(() => { firstRenderRef.current = false; - - return () => { - if (isReact18OrMore()) { - firstRenderRef.current = true; - } - }; }, []); return {tools, store}; diff --git a/src/lib/core/helpers.ts b/src/lib/core/helpers.ts index 256365f8..7298641f 100644 --- a/src/lib/core/helpers.ts +++ b/src/lib/core/helpers.ts @@ -1,5 +1,3 @@ -import React from 'react'; - import _ from 'lodash'; import {SpecTypes} from './constants'; @@ -29,5 +27,3 @@ export const isObjectSpec = (candidate: any): candidate is ObjectSpec => export const isStringSpec = (candidate: any): candidate is StringSpec => candidate?.type === SpecTypes.String; - -export const isReact18OrMore = () => Number(React.version.split('.')[0]) >= 18;