From e90504e18262a910625f88ac82a6319f62b5845a Mon Sep 17 00:00:00 2001 From: Anna Khismatullina Date: Fri, 11 Apr 2025 13:19:37 +0700 Subject: [PATCH] Fix refs resolving for tag attributes (#8533) Signed-off-by: Anna Khismatullina --- packages/importer/src/huly/cards.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/importer/src/huly/cards.ts b/packages/importer/src/huly/cards.ts index 6b9831ad9f..391412ef1d 100644 --- a/packages/importer/src/huly/cards.ts +++ b/packages/importer/src/huly/cards.ts @@ -602,7 +602,21 @@ export class CardsProcessor { const tagProps: Record = {} this.metadataRegistry.getAttributes(tagAbsPath).forEach((attr, label) => { - tagProps[attr.props.name] = cardHeader[label] + const value = cardHeader[label] + const attrType = attr.props.type + const attrBaseType = attrType._class === core.class.ArrOf ? attrType.of : attrType + const values = attrType._class === core.class.ArrOf ? value : [value] + const propValues: any[] = [] + for (const val of values) { + if (attrBaseType._class === core.class.RefTo) { + const refPath = path.resolve(path.dirname(cardPath), val) + const ref = this.metadataRegistry.getRef(refPath) as Ref + propValues.push(ref) + } else { + propValues.push(val) + } + } + tagProps[attr.props.name] = attrType._class === core.class.ArrOf ? propValues : propValues[0] }) const mixin: UnifiedMixin = {