Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(appshot): hide the area controls until the backend knows about them

rubenluetke10-beep5d086b37cd00
diff --git a/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsx b/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsx
index bd53dd1bc0..256def2853 100644
--- a/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AppshotsView.test.tsx
@@ -129,6 +129,20 @@ describe("AppshotsView area appshots", () => {
expect(useEventStore.getState().toasts).toEqual([]);
});
+ it("hides the area controls while an older backend is still running", async () => {
+ const { region_hotkey: _hotkey, region_shortcut: _status, ...older } = SETTINGS;
+ fetchMock.mockImplementation(async (url: string) =>
+ url === "/api/appshot/settings"
+ ? json({ ...older, readiness: { capture: true, capture_detail: "", effect: true, effect_detail: "" } })
+ : json({ appshot: null }),
+ );
+ render(<AppshotsView />);
+ await screen.findByTestId("appshots-try");
+ expect(screen.queryByTestId("appshots-region-hotkey")).toBeNull();
+ expect(screen.queryByTestId("appshots-try-region")).toBeNull();
+ expect(screen.queryByText(/undefined/)).toBeNull();
+ });
+
it("disables the area button where no picker can run", async () => {
fetchMock.mockImplementation(async (url: string) =>
url === "/api/appshot/settings"
diff --git a/jarvis/ui/web/frontend/src/views/AppshotsView.tsx b/jarvis/ui/web/frontend/src/views/AppshotsView.tsx
index 61c0b3c535..f069db5c6c 100644
--- a/jarvis/ui/web/frontend/src/views/AppshotsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AppshotsView.tsx
@@ -330,8 +330,12 @@ export function AppshotsView() {
);
})();
+ // A backend from before area appshots sends no region fields; the row and
+ // its button stay hidden until the app restarts onto the new backend.
+ const regionSupported = typeof settings?.region_hotkey === "string";
+
const regionShortcutHint = (() => {
- if (!settings) return "";
+ if (!settings || !regionSupported) return "";
if (!settings.readiness.region) {
return t("appshots.effect_unavailable").replace("{0}", settings.readiness.region_detail);
}
@@ -407,23 +411,25 @@ export function AppshotsView() {
/>
}
/>
- <Row
- label={t("appshots.region_shortcut_label")}
- hint={regionShortcutHint}
- control={
- <BrandedSelect
- value={settings.region_hotkey || "off"}
- options={regionHotkeyOptions}
- ariaLabel={t("appshots.region_shortcut_label")}
- disabled={disabled || saving}
- testId="appshots-region-hotkey"
- className="w-44"
- onValueChange={(value) =>
- void save({ region_hotkey: value === "off" ? "" : value })
- }
- />
- }
- />
+ {regionSupported && (
+ <Row
+ label={t("appshots.region_shortcut_label")}
+ hint={regionShortcutHint}
+ control={
+ <BrandedSelect
+ value={settings.region_hotkey || "off"}
+ options={regionHotkeyOptions}
+ ariaLabel={t("appshots.region_shortcut_label")}
+ disabled={disabled || saving}
+ testId="appshots-region-hotkey"
+ className="w-44"
+ onValueChange={(value) =>
+ void save({ region_hotkey: value === "off" ? "" : value })
+ }
+ />
+ }
+ />
+ )}
<Row
label={t("appshots.target_label")}
hint={targetHint}
@@ -482,19 +488,21 @@ export function AppshotsView() {
}
control={
<div className="flex items-center gap-2">
- <Button
- type="button"
- variant="secondary"
- size="sm"
- disabled={
- disabled || picking || !settings.readiness.region || countdown !== null
- }
- onClick={() => void tryRegion()}
- data-testid="appshots-try-region"
- >
- {picking && <Loader2 className="animate-spin" aria-hidden />}
- {t("appshots.try_region_button")}
- </Button>
+ {regionSupported && (
+ <Button
+ type="button"
+ variant="secondary"
+ size="sm"
+ disabled={
+ disabled || picking || !settings.readiness.region || countdown !== null
+ }
+ onClick={() => void tryRegion()}
+ data-testid="appshots-try-region"
+ >
+ {picking && <Loader2 className="animate-spin" aria-hidden />}
+ {t("appshots.try_region_button")}
+ </Button>
+ )}
<Button
type="button"
variant="secondary"