history-container.tsx 765 B

12345678910111213141516171819202122232425
  1. import { useLayoutContext } from '../../../shared/context/layout-context'
  2. import { FullSizeLoadingSpinner } from '../../../shared/components/loading-spinner'
  3. import { ErrorBoundaryFallback } from '../../../shared/components/error-boundary-fallback'
  4. import withErrorBoundary from '../../../infrastructure/error-boundary'
  5. import { lazy, Suspense } from 'react'
  6. const HistoryRoot = lazy(
  7. () => import('@/features/ide-react/components/history-root')
  8. )
  9. function HistoryContainer() {
  10. const { view } = useLayoutContext()
  11. if (view !== 'history') {
  12. return null
  13. }
  14. return (
  15. <Suspense fallback={<FullSizeLoadingSpinner delay={500} />}>
  16. <HistoryRoot />
  17. </Suspense>
  18. )
  19. }
  20. export default withErrorBoundary(HistoryContainer, ErrorBoundaryFallback)