diff --git a/packages/code-studio/src/main/AppMainContainer.tsx b/packages/code-studio/src/main/AppMainContainer.tsx index e79f11465..b2f88b6b2 100644 --- a/packages/code-studio/src/main/AppMainContainer.tsx +++ b/packages/code-studio/src/main/AppMainContainer.tsx @@ -165,11 +165,14 @@ export class AppMainContainer extends Component< AppMainContainerState > { static handleWindowBeforeUnload(event: BeforeUnloadEvent): void { - event.preventDefault(); - // returnValue is required for beforeReload event prompt - // https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#example - // eslint-disable-next-line no-param-reassign - event.returnValue = ''; + // in development, allow auto-reload + if (import.meta.env.PROD) { + event.preventDefault(); + // returnValue is required for beforeReload event prompt + // https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#example + // eslint-disable-next-line no-param-reassign + event.returnValue = ''; + } } static hydrateConsole(