Skip to content

finding(react): five spellings of one "is this a real config bag?" predicate in packages/react #6761

Description

@os-sales

Observation-class, measured while implementing objectui#6752. No behaviour is wrong; this is one question with several spellings.

The fact, measured on b76ca6764

"Is this value a real config bag (an object, not an array, not null)?" is asked in packages/react in five places, in four different spellings:

  1. SchemaRenderer.tsx — the properties evaluation guard;
  2. SchemaRenderer.tsxpropsWithoutCanonicalKeys, inline;
  3. SchemaRenderer.tsx — the winningVisibilityKey caller block, inline;
  4. utils/propsBagDiagnostic.ts — a private isConfigBag helper (objectui#6708);
  5. utils/unevaluatedExpression.ts — the early return in scanBag (objectui#4795).

objectui#6752 unified 1 and 2 behind a single isConfigBag in SchemaRenderer.tsx, because it had to touch both. Sites 3, 4 and 5 were left alone deliberately: they live in other cards' modules, and merging them is a refactor across cards rather than that one's to make. The new helper's docblock says so rather than leaving it implied.

Why it is worth a line

This repo has repeatedly paid for one question having several spellings — hasDeclaredPredicate exists because "is a gate DECLARED?" had three (objectui#3842 / objectui#3849 / objectui#3850), and the SchemaRenderer comments name a "fourth dialect of one question" as the thing to avoid. The five sites agree today. The cost is that they can drift apart silently: each is a boolean expression whose disagreement produces no error, only a different answer on one channel.

Arms, if anyone takes it

  • export one predicate (a small shared util in packages/react/src) and have all five read it, with a pin that a new spelling fails;
  • or decide the duplication is acceptable at this size and record why, so the next reader does not re-open it.

No behaviour change either way. Not urgent.

Related: objectui#6752 (where sites 1 and 2 were merged), objectui#6708, objectui#4795.

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:dispatchedpriority:p2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions