Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .changeset/10528-grid-object-table-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
'@object-ui/plugin-dashboard': patch
---

Fix: the editable dashboard grid (`dashboard-grid`, `DashboardGridLayout`) now
treats widgets whose data is `{ provider: 'object', object }` the way the
read-only `DashboardRenderer` already does (objectui#10528). Before this change
the grid turned a table, list or pivot widget with that config into a static
node with `data: []`. The tile showed an empty table or cross-tab and sent no
query.

**Table and list widgets now fetch their rows.** The grid builds the same node
`DashboardRenderer` builds for the widget: an `object-data-table`, which loads
the object's rows through the data source. The props match too:

- the provider's `filter` (or the widget's `filter`) reaches the query;
- the widget's `searchable` and `pagination` are honoured, and a `list` never
gets them;
- a row click opens the record in a drawer by default, as on the read-only
dashboard. `options.drillDown` still overrides this. In edit mode, dragging
still starts only from the drag handle.

**Pivot widgets with that config now show the retired-widget placeholder.**
It is the same placeholder `DashboardRenderer` already shows for them ("This
widget uses a retired data format. Edit it to bind a dataset."). Under ADR-0021
a pivot is bound to a dataset, and a dataset-bound pivot still renders as
before.

Widgets bound to inline rows are unchanged, including static-data pivots.
9 changes: 6 additions & 3 deletions .changeset/7353-retire-widget-dataprovider.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ as `dataProvider`, next to `objectName`. The widgets read only `objectName`, so
version policy).** Compared with the released 17.6.0:

- `DashboardRenderer` no longer writes `dataProvider` on the `object-data-table`
node, and `DashboardGridLayout` no longer writes it on the `data-table` and
`pivot` nodes. All three still write `objectName`, and the object-backed table
widget still fetches through it.
node, and `DashboardGridLayout` no longer writes it on any node it builds for a
`provider: 'object'` widget. Since objectui#10528 the grid builds that same
self-fetching `object-data-table` node for such a table widget, and shows the
retired-widget placeholder for such a pivot widget. The `object-data-table`
node still writes `objectName` on both surfaces, and the object-backed table
widget fetches through it.
- In 17.6.0, the `schema` prop types of `ObjectPivotTable` and `ObjectDataTable`
both declare `dataProvider?: { provider: string; object?: string }`. Both now
declare it as a retirement tombstone (`dataProvider?: never`). TypeScript code
Expand Down
47 changes: 32 additions & 15 deletions packages/plugin-dashboard/src/DashboardGridLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,29 @@ export const DashboardGridLayout: React.FC<DashboardGridLayoutProps> = ({
if (dispatch.family === 'table') {
const widgetData = (widget as any).data || options.data;

// provider: 'object' — pass through object config for async data loading
// provider: 'object' — ObjectDataTable fetches the rows (objectui#10528).
// This arm used to emit a STATIC `data-table` with `data: []` and an
// `objectName` that `data-table` never reads, so the tile drew an empty
// table and issued no query, while `DashboardRenderer` fetched and drew
// the same stored widget. It now emits the node that renderer's table arm
// emits, prop for prop: the self-fetching `object-data-table`, the
// provider's `filter`, the declared `searchable` / `pagination` (never on
// a `list`), and default-on drill-to-record. The drill cannot fight the
// editor: dragging starts only from the `.drag-handle` element (see
// `dragConfig` below), and this grid has no widget selection. The two
// copies are held equal by
// `DashboardGridLayout.objectProviderFetch-10528.test.tsx`.
if (isObjectProvider(widgetData)) {
const isList = widgetType === 'list';
const { data: _data, ...restOptions } = options;
return {
type: 'data-table',
type: 'object-data-table',
...restOptions,
objectName: widgetData.object,
data: [],
searchable: false,
pagination: false,
filter: widgetData.filter || widget.filter,
searchable: isList ? false : (widget.searchable ?? false),
pagination: isList ? false : (widget.pagination ?? false),
drillDown: options.drillDown ?? { enabled: true, mode: 'record' as const },
className: "border-0"
};
}
Expand Down Expand Up @@ -414,16 +427,20 @@ export const DashboardGridLayout: React.FC<DashboardGridLayoutProps> = ({
if (dispatch.family === 'pivot') {
const widgetData = (widget as any).data || options.data;

// provider: 'object' — pass through object config for async data loading
if (isObjectProvider(widgetData)) {
const { data: _data, ...restOptions } = options;
return {
type: 'pivot',
...restOptions,
objectName: widgetData.object,
data: [],
};
}
// provider: 'object' — RETIRED, with the same placeholder object
// `DashboardRenderer`'s pivot arm returns (objectui#10528). A pivot is a
// cross-tab, and ADR-0021 puts cross-tabs on the dataset layer only: the
// shared dispatch types this family "dataset-bound only; a non-dataset
// pivot is stale metadata" (`widgetDispatch.ts`). This branch used to emit
// a static `pivot` node with `data: []` and an `objectName` that
// `PivotTable` never reads, so the tile drew an empty cross-tab and sent
// no query, while the read dashboard showed this placeholder for the same
// widget. Mapping it to the self-fetching `object-pivot` instead would
// have revived the removed inline analytics shape in the editor alone.
// A dataset-bound pivot still renders through `DatasetWidget` (the fork
// at the render site below), and the static-data pivot under this branch
// is unchanged.
if (isObjectProvider(widgetData)) return LEGACY_RETIRED_WIDGET_SCHEMA;

return {
type: 'pivot',
Expand Down
12 changes: 7 additions & 5 deletions packages/plugin-dashboard/src/DashboardRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,13 @@ const DashboardRendererInner = forwardRef<HTMLDivElement, DashboardRendererProps
// This arm stays surface-LOCAL and is deliberately not part of the
// shared detector (objectui#4612): it is a statement about what THIS
// surface can draw — nothing here emits a pivot block — not about the
// widget being legacy. `DashboardGridLayout` does still draw pivots from
// static data and from the `provider: 'object'` config, so exporting
// this family-wide arm would have retired two live branches over there.
// The legacy pivot SHAPE is covered on both surfaces by the shared
// sentinel above, which its top-level `object` matches.
// widget being legacy. `DashboardGridLayout` still draws pivots from
// static data, so exporting this family-wide arm would retire that
// live branch over there. Its `provider: 'object'` pivot answers with
// this same placeholder (objectui#10528), imported from the same
// module rather than restated. The legacy pivot SHAPE is covered on
// both surfaces by the shared sentinel above, which its top-level
// `object` matches.
if (dispatch.family === 'pivot') {
return LEGACY_RETIRED_WIDGET_SCHEMA;
}
Expand Down
Loading
Loading