Skip to content

Commit e90504e

Browse files
authored
Fix refs resolving for tag attributes (#8533)
Signed-off-by: Anna Khismatullina <[email protected]>
1 parent 2674b7b commit e90504e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Diff for: packages/importer/src/huly/cards.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,21 @@ export class CardsProcessor {
602602

603603
const tagProps: Record<string, any> = {}
604604
this.metadataRegistry.getAttributes(tagAbsPath).forEach((attr, label) => {
605-
tagProps[attr.props.name] = cardHeader[label]
605+
const value = cardHeader[label]
606+
const attrType = attr.props.type
607+
const attrBaseType = attrType._class === core.class.ArrOf ? attrType.of : attrType
608+
const values = attrType._class === core.class.ArrOf ? value : [value]
609+
const propValues: any[] = []
610+
for (const val of values) {
611+
if (attrBaseType._class === core.class.RefTo) {
612+
const refPath = path.resolve(path.dirname(cardPath), val)
613+
const ref = this.metadataRegistry.getRef(refPath) as Ref<Card>
614+
propValues.push(ref)
615+
} else {
616+
propValues.push(val)
617+
}
618+
}
619+
tagProps[attr.props.name] = attrType._class === core.class.ArrOf ? propValues : propValues[0]
606620
})
607621

608622
const mixin: UnifiedMixin<Card, Tag> = {

0 commit comments

Comments
 (0)