Repository navigation
Conversation
…ableExplorer
The columns option was all-or-nothing: a column was either loaded with its
full summary and filter UI, or excluded entirely. There was no way to show
a column without its histogram/category summary, or to force a different
summary kind than the Arrow-type-driven default.
Add a getColumnKind resolver option ('auto' | 'category' | 'histogram' |
'none') that decides each column's summary kind at a single point:
- 'none' renders the column without a summary; its summary Mosaic clients
are never created, so no summary queries run and the column does not
participate in cross-filtering. Sorting still works.
- 'category'/'histogram' force a specific summary; incompatible requests
fall back to the type-driven default.
- Resolved kinds are value-memoized so an inline resolver lambda does not
tear down and reconnect summary clients on every render.
Also export the default summary cells (DataTableExplorerSummaryCell,
DataTableExplorerHistogramSummaryCell, DataTableExplorerCategorySummaryCell)
and resolveDataTableExplorerColumnKind for custom headers built on
useDataTableExplorer, and demonstrate the option in the deckgl-mosaic
example (coordinate columns shown without summaries).
Co-Authored-By: Claude Fable 5 <[email protected]>
… profiler Derive the resolver type from DataTableExplorerOptions instead so knip does not flag apache-arrow as an unlisted dependency. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for working on this! I agree that the current all-or-nothing behavior is limiting, and adding a way to control the summary strategy per column seems like a useful extension point. I’m less convinced by the motivating latitude/longitude example as currently framed. For that reason, I would avoid changing the earthquake demo. It makes a subjective application choice look like the recommended behavior for coordinate columns. The resolver can be demonstrated through focused tests and documentation instead. The resolver itself makes sense to me. I would consider naming it A couple of implementation concerns:
Overall, I support adding a summary-kind resolver. I’d suggest removing the demo-specific coordinate policy, tightening the naming, and addressing the lifecycle and memoization issues above. |
Problem
DataTableExplorer'scolumnsoption is all-or-nothing: a column is either loaded — with its histogram/category summary and cross-filter UI — or excluded from the table entirely. There is no way to:Latitude/Longitude, where a histogram and brush add noise and query load but no insight), orThe summary kind decision (
histogram/category/unsupported) was hard-coded from the Arrow type in three separate places (useDataTableExplorerColumns,connectDataTableExplorerSummaryClients,createEmptySummaryState), so there was no seam to hook into. Hiding the summary UI from outside wouldn't help either: the summary Mosaic clients would still be created and still run their queries.Solution
Add one deep option instead of a per-column config object:
resolveDataTableExplorerColumnKind(field, getColumnKind?)is now the single decision point for a column's kind; the three call sites consult it instead of re-deriving from the Arrow type.'none'renders the column with no summary cell and creates no summary clients, so no summary queries run and the column doesn't participate in cross-filtering. Sorting and row rendering are unchanged.'category'/'histogram'force a specific summary. Incompatible requests (histogram on a string column, any summary on binary/geometry) fall back to the type-driven default rather than producing broken queries.useDataTableExplorer, so an inline resolver lambda can't tear down and reconnect every summary client on each render — the client lifecycle only restarts when a column's resolved kind actually changes.useDataTableExplorer, the default summary cells are now exported:DataTableExplorerSummaryCell,DataTableExplorerHistogramSummaryCell,DataTableExplorerCategorySummaryCell, plus the resolver itself.Design notes:
columnsstays a pure projection; render concerns (widths, labels, custom cells) stay in the compound-component layer. The resolver is a function, so persisted surfaces (dashboard panels / block documents) that want this can layer a serializableRecord<string, kind>on top later — deliberately not included here. A read-only summary mode ("show histogram, disable brushing") is a distinct axis and also deliberately out of scope.How to test
pnpm install && pnpm build'auto','none'always honored, incompatible overrides rejected):resolveDataTableExplorerColumnKindblock in__tests__/data-table-explorer.utils.test.ts.Latitude/Longitudeto'none':Latitude/Longitudeshow name + type badge only — no histogram, no brush. Clicking the header still sorts.DateTime/Magnitudehistograms,MagType/Sourcecategory buckets).Mdbucket underMagType: rows filter (≈45,330 of 54,936), all summaries update, and the'none'columns stay summary-less.'category'forDepthinEarthquakeProfiler.tsx'sgetColumnKindto see a numeric column forced to category buckets, with bucket-click filtering working.All three steps verified locally (macOS, headless Chromium screenshots for step 3).
🤖 Generated with Claude Code