From 901f369bc48dd89f70f77584eed1185580781642 Mon Sep 17 00:00:00 2001 From: os-sales Date: Fri, 21 Aug 2026 17:06:17 +0000 Subject: [PATCH] refactor(plugin-dashboard): drop the unreachable DatasetWidget arm from the self-contained branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `isSelfContained` is `widget.type === 'metric' && !datasetBound`, and the `isSelfContained` arm of `renderedNode` forked on `datasetBound` a second time. The `datasetBound` side of that inner fork could never execute: reaching it required `isSelfContained`, which requires `!datasetBound`. Render `SchemaRenderer` unconditionally there and name the invariant in a comment so the arm is not re-added by the next person mirroring this shape. The reachable fork in the Card branch — the one that gives a dataset-bound metric its title and border chrome — is untouched, and behaviour is unchanged. Fixes #4620 Co-Authored-By: Claude --- ...ard-self-contained-unreachable-arm-4620.md | 19 +++++++++++++++++++ .../src/DashboardRenderer.tsx | 8 +++++--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .changeset/dashboard-self-contained-unreachable-arm-4620.md diff --git a/.changeset/dashboard-self-contained-unreachable-arm-4620.md b/.changeset/dashboard-self-contained-unreachable-arm-4620.md new file mode 100644 index 000000000..7d8e70c29 --- /dev/null +++ b/.changeset/dashboard-self-contained-unreachable-arm-4620.md @@ -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. diff --git a/packages/plugin-dashboard/src/DashboardRenderer.tsx b/packages/plugin-dashboard/src/DashboardRenderer.tsx index c49b5bbda..b0ea8c311 100644 --- a/packages/plugin-dashboard/src/DashboardRenderer.tsx +++ b/packages/plugin-dashboard/src/DashboardRenderer.tsx @@ -885,9 +885,11 @@ const DashboardRendererInner = forwardRef - {datasetBound - ?
- : } + {/* `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). */} + {designMode && ) : (