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
19 changes: 19 additions & 0 deletions .changeset/dashboard-self-contained-unreachable-arm-4620.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
---
'@object-ui/plugin-dashboard': patch
---

`DashboardRenderer` drops the unreachable `DatasetWidget` fork from its self-contained
(card-less) branch, leaving that branch to render `SchemaRenderer` unconditionally
(objectui#4620).

`isSelfContained` is defined as `widget.type === 'metric' && !datasetBound`, and the
`isSelfContained` arm of `renderedNode` then forked on `datasetBound` a second time. The
`datasetBound` side of that inner fork could never execute: reaching it required
`isSelfContained` to be true, which requires `!datasetBound`. Behaviour is unchanged —
the removed arm never ran, and the reachable fork in the Card branch (the one that gives
a dataset-bound metric its title and border chrome) is untouched.

The cost was to readers, not to users: the shape read as "both branches handle
dataset-bound widgets" when only one can, and a previous PR mirroring this fork onto
`DashboardGridLayout` had to pay for the reachability argument before it could decline to
copy the dead limb. A comment now names the invariant in place so the arm is not re-added.
8 changes: 5 additions & 3 deletions packages/plugin-dashboard/src/DashboardRenderer.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -885,9 +885,11 @@ const DashboardRendererInner = forwardRef<HTMLDivElement, DashboardRendererProps
style={innerGridSpanStyle}
{...designModeProps}
>
{datasetBound
? <div className={cn("h-full w-full", designMode && "pointer-events-none")}><DatasetWidget widget={effectiveWidget} dataSource={dataSource} /></div>
: <SchemaRenderer schema={componentSchema} className={cn("h-full w-full", designMode && "pointer-events-none")} dataSource={dataSource} />}
{/* `isSelfContained` implies `!datasetBound` (see its definition above), so a
dataset-bound widget can never render here — it always takes the Card branch
below for its title + border chrome. Do not re-add a `datasetBound` fork
here: the arm is unreachable by construction (objectui#4620). */}
<SchemaRenderer schema={componentSchema} className={cn("h-full w-full", designMode && "pointer-events-none")} dataSource={dataSource} />
{designMode && <div className="absolute inset-0 z-10" aria-hidden="true" data-testid="widget-click-overlay" />}
</div>
) : (
Expand Down
Loading