diff --git a/packages/editor/src/components/EditorContainer.tsx b/packages/editor/src/components/EditorContainer.tsx index d18eb18fd3..e62b06f908 100644 --- a/packages/editor/src/components/EditorContainer.tsx +++ b/packages/editor/src/components/EditorContainer.tsx @@ -41,7 +41,7 @@ import { t } from 'i18next' import { DockLayout, DockMode, LayoutData } from 'rc-dock' import React, { useEffect, useRef } from 'react' import { useHotkeys } from 'react-hotkeys-hook' -import Toolbar, { confirmSceneSaveIfModified } from '../components/toolbar/Toolbar' +import Toolbar from '../components/toolbar/Toolbar' import { cmdOrCtrlString } from '../functions/utils' import { EditorErrorState } from '../services/EditorErrorServices' import { EditorState } from '../services/EditorServices' @@ -202,17 +202,12 @@ const EditorContainer = () => { useEffect(() => { const handleBeforeUnload = async (event: BeforeUnloadEvent) => { - if (!(await confirmSceneSaveIfModified())) { + if (EditorState.isModified()) { event.preventDefault() - event.returnValue = '' } } - window.addEventListener('beforeunload', handleBeforeUnload) - - return () => { - window.removeEventListener('beforeunload', handleBeforeUnload) - } + return () => window.removeEventListener('beforeunload', handleBeforeUnload) }, []) return ( diff --git a/packages/ui/src/components/editor/panels/Viewport/container/index.tsx b/packages/ui/src/components/editor/panels/Viewport/container/index.tsx index 5764bac504..11531b6605 100644 --- a/packages/ui/src/components/editor/panels/Viewport/container/index.tsx +++ b/packages/ui/src/components/editor/panels/Viewport/container/index.tsx @@ -29,7 +29,7 @@ import { uploadToFeathersService } from '@etherealengine/client-core/src/util/up import { FeatureFlags } from '@etherealengine/common/src/constants/FeatureFlags' import { clientSettingPath, fileBrowserUploadPath } from '@etherealengine/common/src/schema.type.module' import { processFileName } from '@etherealengine/common/src/utils/processFileName' -import { getComponent, useComponent, useQuery } from '@etherealengine/ecs' +import { useComponent, useQuery } from '@etherealengine/ecs' import { ItemTypes, SupportedFileTypes } from '@etherealengine/editor/src/constants/AssetTypes' import { EditorControlFunctions } from '@etherealengine/editor/src/functions/EditorControlFunctions' import { addMediaNode } from '@etherealengine/editor/src/functions/addMediaNode' @@ -37,7 +37,6 @@ import { getCursorSpawnPosition } from '@etherealengine/editor/src/functions/scr import { EditorState } from '@etherealengine/editor/src/services/EditorServices' import { GLTFComponent } from '@etherealengine/engine/src/gltf/GLTFComponent' import { ResourcePendingComponent } from '@etherealengine/engine/src/gltf/ResourcePendingComponent' -import { SourceComponent } from '@etherealengine/engine/src/scene/components/SourceComponent' import useFeatureFlags from '@etherealengine/engine/src/useFeatureFlags' import { useMutableState } from '@etherealengine/hyperflux' import { TransformComponent } from '@etherealengine/spatial' @@ -124,7 +123,6 @@ const SceneLoadingProgress = ({ rootEntity }) => { const progress = useComponent(rootEntity, GLTFComponent).progress.value const loaded = GLTFComponent.useSceneLoaded(rootEntity) const resourcePendingQuery = useQuery([ResourcePendingComponent]) - const root = getComponent(rootEntity, SourceComponent) if (loaded) return null