fix(P0-2): 修复lint警告,availableTypes用useMemo包裹
CI/CD Pipeline / Frontend Lint (push) Failing after 22h27m36s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 22h27m36s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1681h1m55s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1681h1m57s
CI/CD Pipeline / Build Production Runtime Images (push) Failing after 1681h1m59s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (push) Failing after 1681h1m59s
CI/CD Pipeline / Deploy Production (push) Failing after 1681h33m25s
CI/CD Pipeline / Frontend Lint (push) Failing after 22h27m36s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 22h27m36s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1681h1m55s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1681h1m57s
CI/CD Pipeline / Build Production Runtime Images (push) Failing after 1681h1m59s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (push) Failing after 1681h1m59s
CI/CD Pipeline / Deploy Production (push) Failing after 1681h33m25s
This commit is contained in:
@@ -9,6 +9,7 @@ import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
} from "react";
|
||||
import type { ClipData, ClipType } from "../types";
|
||||
|
||||
@@ -59,12 +60,15 @@ const TimelinePanel: React.FC<TimelinePanelProps> = ({
|
||||
const [addDuration, setAddDuration] = useState<number>(5);
|
||||
|
||||
/* ── 根据模式决定可选类型 ── */
|
||||
const availableTypes: ClipType[] =
|
||||
currentMode === "voice_over"
|
||||
? ["voice"]
|
||||
: currentMode === "pip"
|
||||
? ["pip"]
|
||||
: ["voice", "pip"]; // voice_pip 或默认
|
||||
const availableTypes: ClipType[] = useMemo(
|
||||
() =>
|
||||
currentMode === "voice_over"
|
||||
? ["voice"]
|
||||
: currentMode === "pip"
|
||||
? ["pip"]
|
||||
: ["voice", "pip"], // voice_pip 或默认
|
||||
[currentMode],
|
||||
);
|
||||
|
||||
|
||||
/* ── 模式切换时自动更新默认添加类型 ── */
|
||||
@@ -72,7 +76,7 @@ const TimelinePanel: React.FC<TimelinePanelProps> = ({
|
||||
if (!availableTypes.includes(addType)) {
|
||||
setAddType(availableTypes[0]);
|
||||
}
|
||||
}, [currentMode]);
|
||||
}, [currentMode, addType, availableTypes]);
|
||||
/* ── 面板尺寸(宽度固定,高度由 useLayoutEffect 实测) ── */
|
||||
const PICKER_W = 240; // 面板宽度(与 CSS 一致)
|
||||
const GAP = 6; // 面板与"+"卡片的间距
|
||||
|
||||
Reference in New Issue
Block a user