forked from Yara724/api
Fixed unstable parts fetching from fanavaran
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user