Skip to content

Commit

Permalink
fix: reuse existing state
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekstosio committed Jan 14, 2025
1 parent 00de04e commit ec8b041
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function DevicesNotFoundView() {
}

async function createAndroidDevice() {
setIsCreating(true);
if (errors?.emulator) {
utils.showDismissableError(errors?.emulator.message);
return;
Expand All @@ -99,11 +98,9 @@ function DevicesNotFoundView() {
const { modelId, modelName } = firstAndroidDevice;
await deviceManager.createAndroidDevice(modelId, modelName, newestImage);
});
setIsCreating(false);
}

async function createIOSDevice() {
setIsCreating(true);
if (errors?.simulator) {
utils.showDismissableError(errors.simulator.message);
return;
Expand All @@ -118,7 +115,6 @@ function DevicesNotFoundView() {
const iOSDeviceType = firstRuntimeSupportedDevice(newestRuntime.supportedDeviceTypes);
await deviceManager.createIOSDevice(iOSDeviceType!, iOSDeviceType!.name, newestRuntime);
});
setIsCreating(false);
}
return (
<div className="devices-not-found-container">
Expand All @@ -132,7 +128,7 @@ function DevicesNotFoundView() {
<div className="devices-not-found-button-group">
{Platform.OS === "macos" && (
<Button
disabled={isCreating}
disabled={isIOSCreating}
type="ternary"
className="devices-not-found-quick-action"
onClick={createIOSDevice}>
Expand All @@ -142,7 +138,7 @@ function DevicesNotFoundView() {
)}

<Button
disabled={isCreating}
disabled={isAndroidCreating}
type="ternary"
className="devices-not-found-quick-action"
onClick={createAndroidDevice}>
Expand Down

0 comments on commit ec8b041

Please sign in to comment.