Skip to content

Commit

Permalink
feat(connect): make transportReconnect implicitly true
Browse files Browse the repository at this point in the history
  • Loading branch information
martykan committed Nov 7, 2024
1 parent e436527 commit 233939a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/connect/e2e/common.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const initTrezorConnect = async (
debug: false,
popup: false,
pendingTransportEvent: true,
transportReconnect: false,
connectSrc: process.env.TREZOR_CONNECT_SRC, // custom source for karma tests
...options,
});
Expand Down
6 changes: 5 additions & 1 deletion packages/connect/src/core/__tests__/Core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { initCoreState } from '../index';
const { createTestTransport } = global.JestMocks;

const getSettings = (partial: Partial<ConnectSettings> = {}) =>
parseConnectSettings({ transports: [createTestTransport()], ...partial });
parseConnectSettings({
transports: [createTestTransport()],
transportReconnect: false,
...partial,
});

describe('Core', () => {
beforeAll(async () => {});
Expand Down
1 change: 1 addition & 0 deletions packages/connect/src/data/connectSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const initialSettings: ConnectSettings = {
interactionTimeout: 600, // 5 minutes
sharedLogger: true,
deeplinkUrl: `${DEFAULT_DOMAIN}deeplink/${DEEPLINK_VERSION}/`,
transportReconnect: true,
};

const parseManifest = (manifest?: Manifest) => {
Expand Down
4 changes: 3 additions & 1 deletion packages/connect/src/device/DeviceList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ export class DeviceList extends TypedEmitter<DeviceListEvents> implements IDevic
const { promise, reject } = resolveAfter(1000, initParams);
this.rejectPending = reject;

return promise.then(this.createInitPromise.bind(this));
return promise.then(this.createInitPromise.bind(this)).finally(() => {
this.rejectPending = undefined;
});
}

private async selectTransport([transport, ...rest]: Transport[]): Promise<Transport> {
Expand Down

0 comments on commit 233939a

Please sign in to comment.