fix: optimize ArtifactListImpl

This commit is contained in:
tao.chen
2026-08-20 20:29:22 +08:00
parent 05c2157c4a
commit 3dc049f46e
3 changed files with 45 additions and 8 deletions
@@ -1,8 +1,13 @@
import { memo } from "react";
import { type ScheduleArtifact } from "../../services/api";
import Icon from "../../components/common/Icon";
import { shortHash } from "./utils";
export function ArtifactList({
// 包裹 memo 让父级 SchedulePage 在画布交互(setSelectedNodeId /
// setSelectedEdgeId / linkSourceId 等)重渲染时,artifact 卡片不会跟着
// 重建/重绑拖拽事件 —— 减少拖动过程中的事件重绑与列表抖动。
function ArtifactListImpl({
artifacts,
keyword,
onDrop,
@@ -77,3 +82,5 @@ export function ArtifactList({
</section>
);
}
export const ArtifactList = memo(ArtifactListImpl);