Skip to content

Commit 1638260

Browse files
committed
clean up
1 parent 367678f commit 1638260

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps/web/client/src/app/project/[id]/_components/bottom-bar/restart-sandbox-button.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,14 @@ export const RestartSandboxButton = observer(({
8181

8282
const handleRestartSandbox = async () => {
8383
try {
84+
if (restarting) {
85+
return;
86+
}
8487
const activeBranch = branches.activeBranch;
85-
if (!activeBranch || restarting) return;
88+
if (!activeBranch) return;
89+
if (restarting) {
90+
return;
91+
}
8692

8793
setRestarting(true);
8894
setHasSandboxError(false);
@@ -97,7 +103,6 @@ export const RestartSandboxButton = observer(({
97103

98104
const success = await sandbox.session.restartDevServer();
99105
if (success) {
100-
toast.loading('Restarting sandbox...');
101106
// Wait 5 seconds before refreshing webviews to avoid 502 errors
102107
setTimeout(() => {
103108
const frames = editorEngine.frames.getByBranchId(activeBranch.id);
@@ -119,8 +124,6 @@ export const RestartSandboxButton = observer(({
119124
} catch (error) {
120125
console.error('Error restarting sandbox:', error);
121126
toast.error('An error occurred while restarting the sandbox');
122-
} finally {
123-
toast.dismiss();
124127
setRestarting(false);
125128
}
126129
};

0 commit comments

Comments
 (0)