Skip to content

fix(bindx-ui): offer no filter actions on an empty has-one cell - #137

Merged
matej21 merged 2 commits into
mainfrom
fix/has-one-column-empty-cell-filter
Oct 30, 2026
Merged

matej21 merged 2 commits into
mainfrom
fix/has-one-column-empty-cell-filter

Conversation

@matej21

@matej21 matej21 commented Sep 29, 2026

Copy link
Copy Markdown
Member

Fixes #136

Problem

DataGridHasOneColumn wraps every cell in the include/exclude filter tooltip when the related handle has an id. A disconnected has-one still returns a placeholder id (__placeholder_…), so an empty cell got the tooltip too. „Filter" or „Exclude" there stored the placeholder id in the filter artifact, and the server rejected the resulting { id: { eq: "__placeholder_…" } } condition as an invalid id.

Change

  • has-one-column.tsx: wrap the cell only when the related id is a persisted id (isPersistedId). An empty relation, and a temporary id, render the plain cell content.
  • An empty value stays filterable through the column's null („N/A") filter.
  • has-many-column.tsx is not changed: a has-many handle has no id, so its wrapper already returns the plain content.

Tests

  • New tests/react/dataview/hasOneColumnEmptyCellFilter.test.tsx: a grid with one connected and one empty author. The connected cell has the tooltip trigger; the empty cell has none. It fails on main (commit c741fad) and passes with the fix.
  • bun run typecheck and bun run test (2199 pass) pass locally. The browser suite was not run locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_013L98ArhvRJ1p7riCvTRXBf

@matej21

matej21 commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Review round 1

  • Reviewer: review agent (claude-opus-5-5)
  • Commit reviewed: 05fcae8 (base 7ae3d15)
  • Verdict: approve

The guard in renderCellWrapper now skips the include/exclude tooltip unless the related id is a persisted id. That covers both the disconnected placeholder id and a temporary id from an unsaved entity. isPersistedId is exported from @contember/bindx. The empty value stays filterable through the column's null filter. The regression test renders a connected and an empty cell and checks the tooltip trigger on each, so it covers the changed behaviour.

Findings

  • nit: ?? null was dropped, so id is now string | undefined. No behaviour change, because !id handles both.

No correctness, security or test-coverage issues found.

@matej21
matej21 force-pushed the fix/has-one-column-empty-cell-filter branch from 05fcae8 to bceeace Compare October 30, 2026 15:07
matej21 and others added 2 commits October 30, 2026 16:14
A disconnected has-one still exposes a placeholder id, so the cell
wrapper's `if (!id)` guard never triggered on an empty relation. The
cell offered include/exclude, and either action filtered on
`__placeholder_…`, which the server rejects as an invalid id.

Wrap the cell only when the related id is a persisted one. An empty
value stays filterable through the column's null filter.

Fixes #136

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013L98ArhvRJ1p7riCvTRXBf
@matej21
matej21 force-pushed the fix/has-one-column-empty-cell-filter branch from bceeace to 9505f78 Compare October 30, 2026 15:14
@matej21
matej21 merged commit 062307b into main Oct 30, 2026
4 checks passed
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.

DataGridHasOneColumn offers include/exclude on an empty has-one cell and filters on a placeholder id

1 participant