Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/console/src/components/ObjectManagerListAdapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { toast } from 'sonner';
import { useMetadata } from '../context/MetadataProvider';
import { useMetadataService } from '../hooks/useMetadataService';
import { MetadataService } from '../services/MetadataService';
import { toObjectDefinition, type MetadataObject } from '../utils/metadataConverters';
import { toObjectDefinition } from '../utils/metadataConverters';
import type { MetadataListComponentProps } from '../config/metadataTypeRegistry';

export function ObjectManagerListAdapter({ basePath, metadataType }: MetadataListComponentProps) {
Expand Down
2 changes: 1 addition & 1 deletion apps/console/src/components/schema/objectDetailWidgets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function useObjectData(objectName: string) {
);

const object = useMemo(
() => (metadataObject ? toObjectDefinition(metadataObject) : null),
() => (metadataObject ? toObjectDefinition(metadataObject, 0) : null),
[metadataObject],
);

Expand Down
3 changes: 1 addition & 2 deletions apps/console/src/pages/system/SystemHubPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
Badge,
} from '@object-ui/components';
import {
LayoutGrid,
Users,
Building2,
Shield,
Expand All @@ -35,7 +34,7 @@ import { getIcon } from '../../utils/getIcon';
interface HubCard {
title: string;
description: string;
icon: React.ComponentType<{ className?: string }>;
icon: React.ElementType;
href: string;
Comment on lines 34 to 38
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HubCard.icon was widened to React.ElementType, but the rendering code uses <Icon className="..." />. ElementType doesn’t guarantee the component accepts className, so this reduces type safety and can mask icon incompatibilities. Prefer a more specific icon type (e.g., LucideIcon from lucide-react or React.ComponentType<{ className?: string }>), and adjust getIcon()’s return type accordingly so call sites stay type-safe.

Copilot uses AI. Check for mistakes.
countLabel: string;
count: number | null;
Expand Down
4 changes: 2 additions & 2 deletions apps/console/src/utils/metadataConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @module utils/metadataConverters
*/

import type { ObjectDefinition, DesignerFieldDefinition, DesignerFieldType } from '@object-ui/types';
import type { ObjectDefinition, ObjectDefinitionRelationship, DesignerFieldDefinition, DesignerFieldType } from '@object-ui/types';

// ---------------------------------------------------------------------------
// Raw metadata shapes (from the ObjectStack API)
Expand Down Expand Up @@ -87,7 +87,7 @@ export function toObjectDefinition(obj: MetadataObject, index: number): ObjectDe
relationships: Array.isArray(obj.relationships)
? obj.relationships.map((r) => ({
relatedObject: r.object || r.relatedObject || '',
type: r.type || 'one-to-many',
type: (r.type || 'one-to-many') as ObjectDefinitionRelationship['type'],
label: r.label || r.name || undefined,
foreignKey: r.foreign_key || r.foreignKey || undefined,
Comment on lines 88 to 92
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting r.type to ObjectDefinitionRelationship['type'] bypasses the union constraint at compile-time and can let unexpected API values flow into ObjectDefinition.relationships. Consider normalizing/validating r.type against the allowed set ('one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many') and falling back to 'one-to-many' when it’s not one of those, instead of a blind type assertion.

Copilot uses AI. Check for mistakes.
}))
Expand Down