diff --git a/web/app/(commonLayout)/apps/NewAppCard.tsx b/web/app/(commonLayout)/apps/NewAppCard.tsx index a90af4ea85..fe71fefd52 100644 --- a/web/app/(commonLayout)/apps/NewAppCard.tsx +++ b/web/app/(commonLayout)/apps/NewAppCard.tsx @@ -1,6 +1,6 @@ 'use client' -import { forwardRef, useMemo, useState } from 'react' +import { useMemo, useState } from 'react' import { useRouter, useSearchParams, @@ -18,7 +18,15 @@ export type CreateAppCardProps = { onSuccess?: () => void } -const CreateAppCard = forwardRef(({ className, onSuccess }, ref) => { +const CreateAppCard = ( + { + ref, + className, + onSuccess, + }: CreateAppCardProps & { + ref: React.RefObject; + }, +) => { const { t } = useTranslation() const { onPlanInfoChanged } = useProviderContext() const searchParams = useSearchParams() @@ -103,7 +111,7 @@ const CreateAppCard = forwardRef(({ classNam /> ) -}) +} CreateAppCard.displayName = 'CreateAppCard' export default CreateAppCard diff --git a/web/app/(commonLayout)/datasets/NewDatasetCard.tsx b/web/app/(commonLayout)/datasets/NewDatasetCard.tsx index 5dd244ad41..99b612cd1a 100644 --- a/web/app/(commonLayout)/datasets/NewDatasetCard.tsx +++ b/web/app/(commonLayout)/datasets/NewDatasetCard.tsx @@ -1,20 +1,23 @@ 'use client' - -import { forwardRef } from 'react' import { useTranslation } from 'react-i18next' import { RiAddLine, RiArrowRightLine, } from '@remixicon/react' -const CreateAppCard = forwardRef((_, ref) => { +const CreateAppCard = ( + { + ref, + ..._ + }, +) => { const { t } = useTranslation() return (
- +
) -}) +} CreateAppCard.displayName = 'CreateAppCard' diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx index 74c4a30807..bb60648adb 100644 --- a/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx +++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.tsx @@ -1,10 +1,4 @@ -import { - forwardRef, - memo, - useCallback, - useImperativeHandle, - useMemo, -} from 'react' +import { memo, useCallback, useImperativeHandle, useMemo } from 'react' import { useConfigFromDebugContext, useFormattingChangedSubscription, @@ -34,9 +28,14 @@ type DebugWithSingleModelProps = { export type DebugWithSingleModelRefType = { handleRestart: () => void } -const DebugWithSingleModel = forwardRef(({ - checkCanSend, -}, ref) => { +const DebugWithSingleModel = ( + { + ref, + checkCanSend, + }: DebugWithSingleModelProps & { + ref: React.RefObject; + }, +) => { const { userProfile } = useAppContext() const { modelConfig, @@ -174,7 +173,7 @@ const DebugWithSingleModel = forwardRef ) -}) +} DebugWithSingleModel.displayName = 'DebugWithSingleModel' diff --git a/web/app/components/base/auto-height-textarea/common.tsx b/web/app/components/base/auto-height-textarea/common.tsx index 98ff0b7272..8cc2bedd06 100644 --- a/web/app/components/base/auto-height-textarea/common.tsx +++ b/web/app/components/base/auto-height-textarea/common.tsx @@ -1,53 +1,53 @@ -import { forwardRef, useEffect, useRef } from 'react' +import { useEffect, useRef } from 'react' import cn from '@/utils/classnames' type AutoHeightTextareaProps = & React.DetailedHTMLProps, HTMLTextAreaElement> & { outerClassName?: string } -const AutoHeightTextarea = forwardRef( - ( - { - outerClassName, - value, - className, - placeholder, - autoFocus, - disabled, - ...rest - }, - outRef, - ) => { - const innerRef = useRef(null) - const ref = outRef || innerRef - - useEffect(() => { - if (autoFocus && !disabled && value) { - if (typeof ref !== 'function') { - ref.current?.setSelectionRange(`${value}`.length, `${value}`.length) - ref.current?.focus() - } - } - }, [autoFocus, disabled, ref]) - return ( -
-
-
- {!value ? placeholder : `${value}`.replace(/\n$/, '\n ')} -
-