From 8d15c5fa1053a97e6640acd578c744acba6bdadf Mon Sep 17 00:00:00 2001 From: Coze Agent Date: Mon, 5 Oct 2026 15:49:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(lint):=20DurationWheelPicker=20options=20?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20useMemo=20=E5=8C=85=E8=A3=B9=E4=BB=A5?= =?UTF-8?q?=E6=BB=A1=E8=B6=B3=20exhaustive-deps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/DurationWheelPicker/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/common/DurationWheelPicker/index.tsx b/apps/web/src/components/common/DurationWheelPicker/index.tsx index a087ca853..09faa4245 100644 --- a/apps/web/src/components/common/DurationWheelPicker/index.tsx +++ b/apps/web/src/components/common/DurationWheelPicker/index.tsx @@ -7,7 +7,7 @@ * - 支持触摸 / 鼠标滚轮 / 点击跳转;滑动松手后吸附到最近项 * - 范围 15–30 秒,步长 1 秒 */ -import React, { useEffect, useRef, useState, useCallback } from "react" +import React, { useEffect, useRef, useState, useCallback, useMemo } from "react" import "./DurationWheelPicker.css" export interface DurationWheelPickerProps { @@ -41,8 +41,11 @@ const DurationWheelPicker: React.FC = ({ height = 200, disabled = false, }) => { - const options: number[] = [] - for (let v = min; v <= max; v += step) options.push(v) + const options: number[] = useMemo(() => { + const arr: number[] = [] + for (let v = min; v <= max; v += step) arr.push(v) + return arr + }, [min, max, step]) const listRef = useRef(null) const [active, setActive] = useState(value)