overleaf/services/web/frontend/js/features/ide-react/components/ide-root.tsx
Alf Eaton 345f51bedb [ide-react] Improve initial loading behaviour (#15916)
* Defer script loading
* Only mount IdePage once everything has connected

GitOrigin-RevId: 32f16214f26ac6a6d71a9dd332b3c35b8b82deae
2023-11-28 09:04:11 +00:00

18 lines
697 B
TypeScript

import { FC, useState } from 'react'
import { GenericErrorBoundaryFallback } from '@/shared/components/generic-error-boundary-fallback'
import withErrorBoundary from '@/infrastructure/error-boundary'
import IdePage from '@/features/ide-react/components/layout/ide-page'
import { ReactContextRoot } from '@/features/ide-react/context/react-context-root'
import { Loading } from '@/features/ide-react/components/loading'
const IdeRoot: FC = () => {
const [loaded, setLoaded] = useState(false)
return (
<ReactContextRoot>
{loaded ? <IdePage /> : <Loading setLoaded={setLoaded} />}
</ReactContextRoot>
)
}
export default withErrorBoundary(IdeRoot, GenericErrorBoundaryFallback)