Skip to content

ObjectGantt's export filename stringifies a label locale map to "[object Object]" — BaseSchema.label is string | I18nLabel #6052

Description

@yinlianghui

Measured while implementing #5903. Filed rather than fixed there: #5903's fence
is the declaration surface, and its PR is deliberately behaviour-preserving at
this line.

The fact

packages/plugin-gantt/src/ObjectGantt.tsx, the exportFileName fallback chain
handed to GanttView:

String(
  ganttConfig?.exportFileName ?? schema.label ?? objectSchema?.label ?? schema.objectName ?? ''
) || undefined

schema.label is BaseSchema['label'], which since #4580's revised Q1-A ruling
is string | I18nLabel — and I18nLabel is string | Record<string, string>,
the spec's INLINE locale map. So a gantt authored as

{ "type": "object-gantt", "objectName": "task", "label": { "en": "Shift Plan", "zh-CN": "排班计划" } }

exports its CSV/PNG named [object Object].

Why it was invisible until now

The read was (schema as any).label, so the union never reached the String().
#5903 drops that cast (the key needs no declaration — BaseSchema already
carries it), which makes the union visible at the call site for the first time.
The behaviour is unchanged by that card; only the visibility is new.

The shape of the fix

resolveI18nLabel(label, locale) from @objectstack/spec/ui is the resolver
that owns this vocabulary, and the file already has a display locale in scope
(useDisplayLocale). Note objectSchema?.label, the very next link in the same
chain, plausibly needs the same treatment — worth measuring together rather than
patching one link.

⚠️ Whichever way it goes, the ?? chain must not grow a lenient coercion: per
AGENTS.md #0.1 the fix is to resolve the declared vocabulary, not to accept a
second one.


Generated by Claude Code

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdomain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:dispatched

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions