Fixed unstable parts fetching from fanavaran

This commit is contained in:
SepehrYahyaee
2026-09-21 10:43:30 +03:30
parent 9dd0ec0c00
commit 8b65e43c60
2 changed files with 48 additions and 0 deletions

View File

@@ -466,6 +466,28 @@ export function sanitizeDamageSelectedPartV2(
}
}
// Fanavaran serves this catalog live and can add ids that do not exist in
// our fallback snapshot yet. Live rows are persisted with their numeric id
// repeated as `name`/`catalogKey` and an empty side. Preserve that identity
// instead of downgrading the row to an internal free-text part. Otherwise a
// newly-added Fanavaran part (for example id 96) disappears from the expert
// reply payload and later fails with PART_NOT_ON_CLAIM.
const numericCatalogIdentity =
id != null &&
Number.isFinite(id) &&
Number(id) > 0 &&
sideTrim === "" &&
(nameTrim === String(id) || String(catalogKey ?? "").trim() === String(id));
if (numericCatalogIdentity) {
return {
id: Number(id),
name: String(id),
side: "",
label_fa: labelTrim || nameTrim || String(id),
catalogKey: String(id),
};
}
if (isInternalDamageSide(side)) {
return {
id: null,