Skip to content

fix(Field): accept accessor chains as help and label - #1334

Merged
mstijak merged 1 commit into
masterfrom
fix/accessor-help-label
Sep 24, 2026
Merged

mstijak merged 1 commit into
masterfrom
fix/accessor-help-label

Conversation

@mstijak

@mstijak mstijak commented Sep 24, 2026

Copy link
Copy Markdown
Member

Fixes #1333.

Problem

Passing an accessor chain to a field's help or label, or to LabeledContainer's label, crashed rendering with ins.scheduleExploreIfVisible is not a function:

<TextField value={m.name} label={m.caption} help={m.hint} />

Field and LabeledContainer decide whether help/label is a widget class by checking isComponentType. An accessor chain returns another accessor for every property read, so that check was truthy and the accessor was used as a widget type.

Change

Only isComponentType === true — the value Component sets on every widget class — now counts as a class, in Field (help, label) and LabeledContainer (label). Accessor chains fall through to the selector branch and become the text, like bind(...) already did. Passing a widget class, such as help={ValidationError}, is unchanged.

Tests

New Field.spec.tsx renders a TextField with an accessor label and help, and a LabeledContainer with an accessor label, and checks the text is rendered. All three failed with the crash before the change.

  • yarn workspace cx run test: 538 passing, 2 pending, 0 failing
  • yarn workspace cx run check-types: no errors

Field and LabeledContainer treated any value with a truthy isComponentType as a widget class. An accessor chain returns another accessor for every property, so it was taken for a class and rendering crashed. Only isComponentType === true, as set by Component, now counts. Fixes #1333.
@mstijak
mstijak merged commit 1a66542 into master Sep 24, 2026
2 checks passed
@mstijak
mstijak deleted the fix/accessor-help-label branch September 24, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessor chain passed to help or label crashes rendering

1 participant