Skip to content

Commit 997edc9

Browse files
authored
feat: Add alert on connect failures, bump deps. (#47)
1 parent 8d14c5e commit 997edc9

File tree

3 files changed

+49
-45
lines changed

3 files changed

+49
-45
lines changed

package-lock.json

Lines changed: 37 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"build-storybook": "storybook build"
1414
},
1515
"dependencies": {
16-
"@tauri-apps/api": "^2.0.0-beta.16",
17-
"@tauri-apps/plugin-cli": "^2.0.0-beta.8",
18-
"@zmkfirmware/zmk-studio-ts-client": "^0.0.16",
16+
"@tauri-apps/api": "^2.0.0",
17+
"@tauri-apps/plugin-cli": "^2.0.0",
18+
"@zmkfirmware/zmk-studio-ts-client": "^0.0.17",
1919
"emittery": "^1.0.3",
2020
"immer": "^10.1.1",
2121
"lucide-react": "^0.445.0",

src/ConnectModal.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useCallback, useEffect, useMemo, useState } from "react";
22

33
import type { RpcTransport } from "@zmkfirmware/zmk-studio-ts-client/transport/index";
4+
import { UserCancelledError } from "@zmkfirmware/zmk-studio-ts-client/transport/errors";
45
import type { AvailableDevice } from "./tauri/index";
56
import { Bluetooth, RefreshCw } from "lucide-react";
67
import { Key, ListBox, ListBoxItem, Selection } from "react-aria-components";
@@ -92,7 +93,9 @@ function deviceList(
9293
onClick={onRefresh}
9394
>
9495
<RefreshCw
95-
className={`size-5 transition-transform ${refreshing ? "animate-spin" : ""}`}
96+
className={`size-5 transition-transform ${
97+
refreshing ? "animate-spin" : ""
98+
}`}
9699
/>
97100
</button>
98101
</div>
@@ -151,8 +154,12 @@ function simpleDevicePicker(
151154
}
152155
setSelectedTransport(undefined);
153156
}
154-
} catch {
157+
} catch (e) {
155158
if (!ignore) {
159+
console.error(e);
160+
if (e instanceof Error && !(e instanceof UserCancelledError)) {
161+
alert(e.message);
162+
}
156163
setSelectedTransport(undefined);
157164
}
158165
}

0 commit comments

Comments
 (0)