From edab4bd24293b562b6c5082f9e8ca4a74de713a2 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Tue, 26 Dec 2023 10:44:42 +0800 Subject: [PATCH] chore: add NODE_ENV to OptionList.displayName (#448) --- src/OptionList.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/OptionList.tsx b/src/OptionList.tsx index 6c83c982..b3b3c1d8 100644 --- a/src/OptionList.tsx +++ b/src/OptionList.tsx @@ -1,14 +1,14 @@ -import * as React from 'react'; -import KeyCode from 'rc-util/lib/KeyCode'; -import useMemo from 'rc-util/lib/hooks/useMemo'; -import type { RefOptionListProps } from 'rc-select/lib/OptionList'; import { useBaseProps } from 'rc-select'; +import type { RefOptionListProps } from 'rc-select/lib/OptionList'; import type { TreeProps } from 'rc-tree'; import Tree from 'rc-tree'; import type { EventDataNode, ScrollTo } from 'rc-tree/lib/interface'; -import type { TreeDataNode, Key } from './interface'; +import KeyCode from 'rc-util/lib/KeyCode'; +import useMemo from 'rc-util/lib/hooks/useMemo'; +import * as React from 'react'; import LegacyContext from './LegacyContext'; import TreeSelectContext from './TreeSelectContext'; +import type { Key, TreeDataNode } from './interface'; import { getAllKeys, isCheckDisabled } from './utils/valueUtil'; const HIDDEN_STYLE = { @@ -30,7 +30,7 @@ interface TreeEventInfo { type ReviseRefOptionListProps = Omit & { scrollTo: ScrollTo }; -const OptionList: React.RefForwardingComponent = (_, ref) => { +const OptionList: React.ForwardRefRenderFunction = (_, ref) => { const { prefixCls, multiple, searchValue, toggleOpen, open, notFoundContent } = useBaseProps(); const { @@ -258,6 +258,9 @@ const OptionList: React.RefForwardingComponent = (_, r }; const RefOptionList = React.forwardRef(OptionList); -RefOptionList.displayName = 'OptionList'; + +if (process.env.NODE_ENV !== 'production') { + RefOptionList.displayName = 'OptionList'; +} export default RefOptionList;