fix(plugins): avoid catalog lookup allocations · openclaw/openclaw@0710eeb
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -137,16 +137,17 @@ function resolveOfficialExternalPluginLookupIds(
|
137 | 137 | entry: OfficialExternalPluginCatalogEntry, |
138 | 138 | ): string[] { |
139 | 139 | const manifest = getOfficialExternalPluginCatalogManifest(entry); |
140 | | -return uniqueStrings( |
141 | | -[ |
142 | | -normalizeOptionalString(manifest?.plugin?.id), |
143 | | -normalizeOptionalString(manifest?.channel?.id), |
144 | | - ...(manifest?.providers ?? []).flatMap((provider) => [ |
145 | | -normalizeOptionalString(provider.id), |
146 | | - ...(provider.aliases ?? []).map((alias) => normalizeOptionalString(alias)), |
147 | | -]), |
148 | | -].filter((value): value is string => Boolean(value)), |
149 | | -); |
| 140 | +const lookupIds = [ |
| 141 | +normalizeOptionalString(manifest?.plugin?.id), |
| 142 | +normalizeOptionalString(manifest?.channel?.id), |
| 143 | +]; |
| 144 | +for (const provider of manifest?.providers ?? []) { |
| 145 | +lookupIds.push(normalizeOptionalString(provider.id)); |
| 146 | +for (const alias of provider.aliases ?? []) { |
| 147 | +lookupIds.push(normalizeOptionalString(alias)); |
| 148 | +} |
| 149 | +} |
| 150 | +return uniqueStrings(lookupIds.filter((value): value is string => Boolean(value))); |
150 | 151 | } |
151 | 152 | |
152 | 153 | export function resolveOfficialExternalPluginLabel( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。