Skip to content

Commit 543ef21

Browse files
fix(ui): Navigate to root on cloud device access settings disconnection (#205)
1 parent a4863f6 commit 543ef21

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ui/src/routes/devices.$id.settings.access._index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { SettingsPageHeader } from "@components/SettingsPageheader";
22
import { SettingsItem } from "./devices.$id.settings";
3-
import { useLoaderData } from "react-router-dom";
3+
import { useLoaderData, useNavigate } from "react-router-dom";
44
import { Button, LinkButton } from "../components/Button";
55
import { CLOUD_APP, DEVICE_API } from "../ui.config";
66
import api from "../api";
@@ -30,6 +30,7 @@ export default function SettingsAccessIndexRoute() {
3030
const loaderData = useLoaderData() as LocalDevice | null;
3131

3232
const { navigateTo } = useDeviceUiNavigation();
33+
const navigate = useNavigate();
3334

3435
const [send] = useJsonRpc();
3536

@@ -78,7 +79,10 @@ export default function SettingsAccessIndexRoute() {
7879
);
7980
return;
8081
}
82+
8183
getCloudState();
84+
// In cloud mode, we need to navigate to the device overview page, as we don't a connection anymore
85+
if (!isOnDevice) navigate("/");
8286
return;
8387
});
8488
};

0 commit comments

Comments
 (0)