Skip to content

Commit c8386b0

Browse files
authored
bug: Optional Lexicon Field (#116)
* Add support for optional lexicon fields
1 parent 3a8bf30 commit c8386b0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/client/src/components/tag/view/TagGridView.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ export const TagGridView: React.FC<TagGridViewProps> = ({
8888
const properties = {} as any;
8989

9090
for (const property of Object.getOwnPropertyNames(study.tagSchema.dataSchema.properties)) {
91-
properties[property] = tag.data!.find((row) => row.name === property);
91+
if (tag.data) {
92+
properties[property] = tag.data!.find((row) => row.name === property);
93+
}
9294
}
9395

9496
newGridData.push({

packages/server/src/tag/transformers/asl-lex-transformer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ export class AslLexFieldTransformer implements FieldTransformer {
1515
_user: TokenPayload,
1616
property: string
1717
): Promise<TagField> {
18+
let tagData = null;
19+
if (data) {
20+
tagData = { key: data, lexicon: uischema.options?.lexicon._id };
21+
}
22+
1823
return {
1924
name: property,
20-
data: { key: data, lexicon: uischema.options?.lexicon._id },
25+
data: tagData,
2126
type: TagFieldType.ASL_LEX
2227
};
2328
}

0 commit comments

Comments
 (0)