Skip to content

Commit

Permalink
🐛 (transport): Fix Chrome windows ble connect
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman committed Jan 27, 2025
1 parent ffaae72 commit 8161b27
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-colts-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/device-transport-kit-web-ble": patch
---

Fix Chrome windows ble connect
5 changes: 5 additions & 0 deletions packages/tools/esbuild-tools/build.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env zx

import "zx/globals";
import { usePowerShell } from "zx";
import esbuild from "esbuild";
import { nodeExternalsPlugin } from "esbuild-node-externals";
import { replaceTscAliasPaths } from "tsc-alias";

if (process.platform === "win32") {
usePowerShell();
}

const config = {
minify: true,
bundle: false,
Expand Down
5 changes: 5 additions & 0 deletions packages/tools/esbuild-tools/watch.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/usr/bin/env zx
import "zx/globals";
import { usePowerShell } from "zx";
import esbuild from "esbuild";
import { nodeExternalsPlugin } from "esbuild-node-externals";
import { replaceTscAliasPaths } from "tsc-alias";

if (process.platform === "win32") {
usePowerShell();
}

const config = {
entryPoints: ["index.ts"],
minify: false,
Expand Down
11 changes: 9 additions & 2 deletions packages/transport/web-ble/src/api/transport/WebBleTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,12 @@ export class WebBleTransport implements Transport {
);
return discoveredDevice;
} catch (error) {
await bleDevice.forget();
this._logger.error("Error while discovering device", {
data: { error, bleDevice },
});
if (bleDevice.forget) {
await bleDevice.forget();
}
throw error;
}
}).caseOf({
Expand Down Expand Up @@ -350,7 +355,9 @@ export class WebBleTransport implements Transport {

return Right(connectedDevice);
} catch (error) {
await internalDevice.bleDevice.forget();
if (internalDevice.bleDevice.forget) {
await internalDevice.bleDevice.forget();
}

this._internalDevicesById.delete(deviceId);

Expand Down

0 comments on commit 8161b27

Please sign in to comment.