Skip to content

Commit 6a824fe

Browse files
shivamhwpclaude
andcommitted
fix(web): a dismissed discovery warning returns for a newly affected platform
Dismissing the panel warning was keyed on the detail alone, so a platform joining the incomplete list with the same detail stayed hidden. Settings showed only the raw detail for a single environment, hiding which list may be incomplete. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent cbf1052 commit 6a824fe

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎apps/web/src/components/device/DevicePanel.browser.test.tsx‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,12 @@ describe("DevicePanel host probe", () => {
217217
describe("DevicePanel discovery warning", () => {
218218
it("keeps Details open across causes and a dismissal only for the cause it hid", async () => {
219219
setup();
220-
const withCause = (detail: string): DeviceServiceState => ({
220+
const withCause = (
221+
detail: string,
222+
incompletePlatforms: ReadonlyArray<"ios" | "android"> = ["ios"],
223+
): DeviceServiceState => ({
221224
...deviceState,
222-
hostStatuses: { local: { status: "ready", detail, incompletePlatforms: ["ios"] } },
225+
hostStatuses: { local: { status: "ready", detail, incompletePlatforms } },
223226
});
224227
const warning = "iOS list on This Mac may be incomplete.";
225228
currentState = withCause("first cause");
@@ -236,6 +239,12 @@ describe("DevicePanel discovery warning", () => {
236239
await screen.rerender(devicePanel(threadA));
237240
await expect.element(screen.getByText(warning)).not.toBeInTheDocument();
238241

242+
currentState = withCause("second cause", ["ios", "android"]);
243+
await screen.rerender(devicePanel(threadA));
244+
await expect
245+
.element(screen.getByText("iOS and Android lists on This Mac may be incomplete."))
246+
.toBeVisible();
247+
239248
currentState = withCause("third cause");
240249
await screen.rerender(devicePanel(threadA));
241250
await expect.element(screen.getByText(warning)).toBeVisible();

‎apps/web/src/components/device/DevicePanel.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,9 @@ function DeviceDiscoveryWarning(props: {
419419
}) {
420420
const [open, setOpen] = useState(false);
421421
const [retrying, setRetrying] = useState(false);
422-
const [dismissedDetail, setDismissedDetail] = useState<string | null>(null);
423-
if (dismissedDetail === props.detail) return null;
422+
const [dismissedCause, setDismissedCause] = useState<string | null>(null);
423+
const cause = `${props.incompletePlatforms.join()}\u0000${props.detail}`;
424+
if (dismissedCause === cause) return null;
424425
const platforms = props.incompletePlatforms.map((platform) =>
425426
platform === "ios" ? "iOS" : "Android",
426427
);
@@ -465,7 +466,7 @@ function DeviceDiscoveryWarning(props: {
465466
aria-label={`Dismiss device warning for ${props.label}`}
466467
onClick={() => {
467468
setOpen(false);
468-
setDismissedDetail(props.detail);
469+
setDismissedCause(cause);
469470
}}
470471
>
471472
<X />

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ function hostStatus(
120120
const incomplete = incompleteListings(status);
121121
if (incomplete.length === 0) return undefined;
122122
const list = incomplete.length > 1 ? "Device" : incomplete[0] === "ios" ? "iOS" : "Android";
123-
return { tone: "warning", label: `${list} list may be incomplete`, detail: status.detail };
123+
const label = `${list} list may be incomplete`;
124+
return { tone: "warning", label, detail: status.detail && `${label}: ${status.detail}` };
124125
}
125126
case "installing":
126127
case "starting":

0 commit comments

Comments
 (0)