Skip to content

Commit

Permalink
Fix wrong logic when deciding to wait for app ready (#102)
Browse files Browse the repository at this point in the history
This PR fixes a bug when we'd use reverse condition to check whether we
should wait for app ready or not. Now after it is fixed when
shouldWaitForAppReady is true we use the promise that waits for an
event. Otherwise, we use a resolved promise.
  • Loading branch information
kmagiera authored Apr 10, 2024
1 parent c4d159a commit 26c4535
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vscode-extension/src/project/deviceSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ export class DeviceSession implements Disposable {
) {
const shouldWaitForAppLaunch = getLaunchConfiguration().preview?.waitForAppLaunch !== false;
const waitForAppReady = shouldWaitForAppLaunch
? Promise.resolve()
: new Promise<void>((res) => {
? new Promise<void>((res) => {
const listener = (event: string, payload: any) => {
if (event === "RNIDE_appReady") {
this.devtools?.removeListener(listener);
res();
}
};
this.devtools?.addListener(listener);
});
})
: Promise.resolve();

progressCallback(StartupMessage.BootingDevice);
await this.device.bootDevice();
Expand Down

0 comments on commit 26c4535

Please sign in to comment.