perf: reduce repeated collection traversal
This commit is contained in:
@@ -91,7 +91,11 @@ export function getCommunityCaseSurface(item: Pick<ServerCommunityCase, "metadat
|
||||
);
|
||||
if (explicitSurface !== "unknown") return explicitSurface;
|
||||
|
||||
const tags = item.tags.map((tag) => tag.trim()).filter(Boolean);
|
||||
const tags: string[] = [];
|
||||
for (const rawTag of item.tags) {
|
||||
const tag = rawTag.trim();
|
||||
if (tag) tags.push(tag);
|
||||
}
|
||||
if (tags.some((tag) => tag.includes("生成页面社区") || tag === "Web生成")) return "generation";
|
||||
if (tags.some((tag) => tag.includes("画布页面社区") || tag.includes("工作流"))) return "canvas";
|
||||
if (getWorkflowFromCase(item)) return "canvas";
|
||||
|
||||
Reference in New Issue
Block a user