Skip to content

Commit ab09917

Browse files
fix(web): environment status tooltip resizes when the status changes (pingdotgg#13845)
1 parent cb97415 commit ab09917

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

‎apps/web/src/components/settings/ConnectionsSettings.tsx‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,14 +1549,29 @@ function SavedBackendListRow({
15491549
versionMismatch !== null &&
15501550
(serverUpdateState.status === "idle" || serverUpdateState.status === "failed");
15511551

1552+
const statusTooltip = `${
1553+
unsupported
1554+
? (environment.connection.error ?? connectionStatusText(environment.connection))
1555+
: enabled
1556+
? connectionStatusText(environment.connection)
1557+
: "Switched off"
1558+
}${
1559+
versionMismatch
1560+
? `\nUpdate available: ${versionMismatch.serverVersion} → ${versionMismatch.clientVersion}`
1561+
: ""
1562+
}`;
1563+
15521564
return (
15531565
<EnvironmentRow
15541566
kind={machineKind}
15551567
label={environment.label}
15561568
dimmed={!enabled}
15571569
subtitle={
15581570
<Tooltip>
1571+
{/* The status can change while the tooltip is open, and base-ui only
1572+
re-measures the popup when the trigger's payload changes. */}
15591573
<TooltipTrigger
1574+
payload={statusTooltip}
15601575
render={
15611576
<span
15621577
className={cn(
@@ -1569,14 +1584,7 @@ function SavedBackendListRow({
15691584
{subtitleText}
15701585
</TooltipTrigger>
15711586
<TooltipPopup side="top" className="whitespace-pre-wrap">
1572-
{unsupported
1573-
? (environment.connection.error ?? connectionStatusText(environment.connection))
1574-
: enabled
1575-
? connectionStatusText(environment.connection)
1576-
: "Switched off"}
1577-
{versionMismatch
1578-
? `\nUpdate available: ${versionMismatch.serverVersion} → ${versionMismatch.clientVersion}`
1579-
: ""}
1587+
{statusTooltip}
15801588
</TooltipPopup>
15811589
</Tooltip>
15821590
}

0 commit comments

Comments
 (0)