Ensure that the editor state is preserved when switching views (#17238)

GitOrigin-RevId: 946b82cb633afbea13a72e30a9ce432aa1a8196d
This commit is contained in:
Alf Eaton
2024-02-23 09:03:06 +00:00
committed by Copybot
parent c8cc34377f
commit 3e11ee6e5a
4 changed files with 58 additions and 57 deletions
@@ -2,7 +2,10 @@ import { Panel, PanelGroup } from 'react-resizable-panels'
import React, { FC, lazy, Suspense } from 'react'
import useScopeValue from '@/shared/hooks/use-scope-value'
import SourceEditor from '@/features/source-editor/components/source-editor'
import { EditorScopeValue } from '@/features/ide-react/context/editor-manager-context'
import {
EditorScopeValue,
useEditorManagerContext,
} from '@/features/ide-react/context/editor-manager-context'
import classNames from 'classnames'
import { LoadingPane } from '@/features/ide-react/components/editor/loading-pane'
import { FullSizeLoadingSpinner } from '@/shared/components/loading-spinner'
@@ -16,6 +19,11 @@ const SymbolPalettePane = lazy(
export const EditorPane: FC = () => {
const [editor] = useScopeValue<EditorScopeValue>('editor')
const { selectedEntityCount, openEntity } = useFileTreeOpenContext()
const { currentDocumentId } = useEditorManagerContext()
if (!currentDocumentId) {
return null
}
const isLoading = Boolean(
(!editor.sharejs_doc || editor.opening) &&