fix(#1677): 移除预览网格截断+空指针防御+排序显式Number(AI Review 第二轮) #1713
@@ -133,7 +133,7 @@ const GeneratePage: React.FC = () => {
|
||||
const [previewVoiceAudioUrl, setPreviewVoiceAudioUrl] = useState<string | null>(null)
|
||||
const ttsAbortRef = useRef<AbortController | null>(null)
|
||||
// TTS 试听文案:批量跟随变体0标题(仅取首项,避免编辑其他变体标题触发多余 TTS 请求)
|
||||
const variant0Title = isBatch ? previewTitles[0] || "" : ""
|
||||
const variant0Title = isBatch ? previewTitles?.[0] || "" : ""
|
||||
|
||||
useEffect(() => {
|
||||
const voiceAsset = voiceMaterials.find((m) => m.id === selectedVoice)
|
||||
|
||||
@@ -22,7 +22,9 @@ const BatchGenerationGrid: React.FC<BatchGenerationGridProps> = ({
|
||||
titles,
|
||||
onRetryTask,
|
||||
}) => {
|
||||
const sorted = [...tasks].sort((a, b) => (a.variantIndex || 0) - (b.variantIndex || 0))
|
||||
const sorted = [...tasks].sort(
|
||||
(a, b) => Number(a.variantIndex || 0) - Number(b.variantIndex || 0),
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="xx-form-section">
|
||||
|
||||
@@ -12,7 +12,6 @@ import type { AssetItem } from "@/api/assets"
|
||||
import type { EditingTemplate } from "@/api/editing-planner"
|
||||
import type { TitleSettings } from "../types"
|
||||
import FrontendPreviewPlayer from "./FrontendPreviewPlayer"
|
||||
import { MAX_PREVIEW_COUNT } from "../constants"
|
||||
|
||||
interface CanvasPreviewGridProps {
|
||||
count: number
|
||||
@@ -42,11 +41,11 @@ const CanvasPreviewGrid: React.FC<CanvasPreviewGridProps> = ({
|
||||
onToggleSelect,
|
||||
selectable = true,
|
||||
}) => {
|
||||
// 硬上限保护:同时播放的媒体元素数量不超过 MAX_PREVIEW_COUNT(10),避免浏览器卡顿
|
||||
const safeCount = Math.max(1, Math.min(count, MAX_PREVIEW_COUNT))
|
||||
// count 上限已在源头 PreviewCountModal 的数量选择(1~MAX_PREVIEW_COUNT=10)clamp,
|
||||
// 这里完整渲染所有变体,保证每个变体都有勾选/预览入口,UI 与数据不脱节
|
||||
return (
|
||||
<div className="xx-canvas-grid">
|
||||
{Array.from({ length: safeCount }, (_, i) => {
|
||||
{Array.from({ length: count }, (_, i) => {
|
||||
const checked = selectedIds.includes(i)
|
||||
return (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user