Skip to content

Commit a70faec

Browse files
fix: address code review feedback
- Remove `any` type from relationship mapping in metadataConverters.ts - Fix redundant relationship label display when label equals relatedObject - Add comment explaining boolean string storage in MetadataFormDialog Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/e40e09cf-a76e-4479-a267-2b75d2430a31 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent 72fa70f commit a70faec

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

apps/console/src/components/MetadataFormDialog.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export function MetadataFormDialog({
6666
const fields = formFields ?? DEFAULT_FORM_FIELDS;
6767
const isEdit = mode === 'edit';
6868

69-
// Form state
69+
// Form state — values are stored as strings because the form is a generic
70+
// key-value store. Boolean fields use 'true'/'false' string representations.
7071
const [values, setValues] = useState<Record<string, string>>({});
7172
const [submitting, setSubmitting] = useState(false);
7273

apps/console/src/pages/system/ObjectManagerPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ function ObjectDetailView({ object, metadataObject, onBack, metadataService, onR
183183
</Badge>
184184
<div className="min-w-0 flex-1 text-sm">
185185
<span className="font-medium">{rel.label || rel.relatedObject}</span>
186-
<span className="text-muted-foreground ml-1">{rel.relatedObject}</span>
186+
{rel.label && rel.label !== rel.relatedObject && (
187+
<span className="text-muted-foreground ml-1">{rel.relatedObject}</span>
188+
)}
187189
{rel.foreignKey && (
188190
<span className="text-muted-foreground text-xs ml-2">(FK: {rel.foreignKey})</span>
189191
)}

apps/console/src/utils/metadataConverters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function toObjectDefinition(obj: MetadataObject, index: number): ObjectDe
8585
enabled: obj.enabled !== false,
8686
fieldCount: fields.length,
8787
relationships: Array.isArray(obj.relationships)
88-
? obj.relationships.map((r: any) => ({
88+
? obj.relationships.map((r) => ({
8989
relatedObject: r.object || r.relatedObject || '',
9090
type: r.type || 'one-to-many',
9191
label: r.label || r.name || undefined,

0 commit comments

Comments
 (0)