Skip to content

fix(Lane): columns are ReactNode again — the union broke every row test - #27

Merged
thinkclay merged 1 commit into
mainfrom
fix/lane-column-discriminator
Sep 1, 2026
Merged

thinkclay merged 1 commit into
mainfrom
fix/lane-column-discriminator

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

#21 gave columns a union of ReactNode | { label, value } so Lane could add the label itself. The app rendered correctly at both widths and I verified it on screen — but every row-rendering test in ApplicationsLanes.test.tsx crashed:

Objects are not valid as a React child (found: object with keys {label, value})

The guard returned false under vitest and true under the app.

What I checked and eliminated

hypothesis result
stale dist the build contained the change (verified in dist/index.mjs)
stale Vite cache cleared node_modules/.vite; no change
isValidElement was the fragile clause swapped for Object.hasOwn checks; no change
the caller was passing something odd rendering Lane alone with one labelled column reproduces it

I stopped there. A render path that guesses what a value is has no business being load-bearing, whatever makes it disagree between two environments.

The fix

columns is ReactNode[] again. The caller composes its own labelled cells — nothing to discriminate, nothing to get wrong. The doc comment says so, so the union does not come back.

The tests that pinned the union now pin its absence, including one asserting a raw descriptor still throws — a caller that hands Lane an object by mistake should fail loudly, not silently.

Behaviour is unchanged

Verified against the running app after the change:

mobile    Score 0 / Source Scaffald / Assignee Unassigned      (empty cells dropped)
desktop   Score 0 / Source Scaffald / Union — / Assignee Unassigned / Outcome —

Same as #21 shipped: labelled at both widths, empties dropped on a phone and held as em dashes on a wide row so the columns line up.

17/17 tests pass across Lane.columns and ApplicationsLanes. Both packages typecheck.

🤖 Generated with Claude Code

#21 gave `columns` a union of `ReactNode | { label, value }` so Lane could add
the label itself. The app rendered correctly at both widths, and I verified it
on screen — but every row-rendering test in ApplicationsLanes.test.tsx crashed:

  Objects are not valid as a React child (found: object with keys {label, value})

The guard returned false under vitest and true under the app. Three
explanations were checked and eliminated: a stale dist (the build had the
change), a stale Vite cache (cleared, no change), and `isValidElement` being
the fragile clause (swapped for own-property checks, no change). Rendering
Lane alone with one labelled column reproduced it, so it was not the caller.

I stopped looking for the specific cause. A render path guessing what a value
is has no business being load-bearing, whatever makes it disagree.

So `columns` is `ReactNode[]` again and the caller composes its own cells.
There is nothing to discriminate and nothing to get wrong.

The tests that pinned the union now pin its absence — including one that
asserts a raw descriptor still throws, so a caller that hands Lane an object by
mistake fails loudly rather than silently.
@thinkclay
thinkclay merged commit a527607 into main Sep 1, 2026
@thinkclay
thinkclay deleted the fix/lane-column-discriminator branch September 1, 2026 15:02
thinkclay added a commit to Scaffald/SaaS that referenced this pull request Sep 1, 2026
#644 described cells to Lane as `{ label, value }` and let Lane render the
label. The app was right at both widths — verified on screen — but every
row-rendering test in ApplicationsLanes.test.tsx crashed with "Objects are not
valid as a React child". Lane's guard evaluated differently under vitest, and
the raw descriptor reached React.

That is 10 tests I merged red without noticing, because I ran the new Lane
tests and not the existing ones for the screen I had changed.

Scaffald/ui#27 takes the union back out. The label is composed here instead,
in a small `cell()` helper that also decides what a narrow row drops — which
is where the decision belonged anyway, since this screen is the only thing
that knows Union and Outcome are worth hiding when empty.

Behaviour is unchanged, checked against the running app:

  mobile   Score 0 / Source Scaffald / Assignee Unassigned
  desktop  Score 0 / Source Scaffald / Union — / Assignee Unassigned / Outcome —

17/17 across Lane.columns and ApplicationsLanes. Both packages typecheck.

Submodule pointer: a720d0b..a527607
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.

1 participant