Skip to content

Commit

Permalink
fix(schema-extract): handle title sometimes being a React node
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Oct 21, 2024
1 parent 58f2407 commit 2feb84c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/presentation/src/overlays/schema/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export function extractSchema(workspace: Workspace, theme: ThemeContextValue): S
return {
type: 'document',
name: schemaType.name,
title: schemaType.title,
title: typeof schemaType.title === 'string' ? schemaType.title : undefined,
icon: extractIcon(schemaType),
fields: {
...documentDefaultFields(schemaType.name),
Expand Down Expand Up @@ -287,7 +287,7 @@ export function extractSchema(workspace: Workspace, theme: ThemeContextValue): S

return {
name: schemaType.name,
title: schemaType.title,
title: typeof schemaType.title === 'string' ? schemaType.title : undefined,
type: 'type',
value,
}
Expand All @@ -307,7 +307,7 @@ export function extractSchema(workspace: Workspace, theme: ThemeContextValue): S
fields[field.name] = {
type: 'objectField',
name: field.name,
title: field.type.title,
title: typeof field.type.title === 'string' ? field.type.title : undefined,
value,
optional: isFieldRequired(field) === false,
}
Expand Down Expand Up @@ -423,7 +423,7 @@ export function extractSchema(workspace: Workspace, theme: ThemeContextValue): S
type: 'unionOption',
icon: extractIcon(item),
name: item.name,
title: item.title,
title: typeof item.title === 'string' ? item.title : undefined,
value: field,
} satisfies SchemaUnionOption
if (field.type === 'inline') {
Expand Down Expand Up @@ -464,7 +464,7 @@ export function extractSchema(workspace: Workspace, theme: ThemeContextValue): S
of: {
type: 'arrayItem',
name,
title,
title: typeof title === 'string' ? title : undefined,
value,
},
}
Expand Down

0 comments on commit 2feb84c

Please sign in to comment.