All files / shared / components LazyLoader.tsx

68.18% Statements 15/22
41.66% Branches 5/12
66.66% Functions 4/6
75% Lines 15/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  134x     22x 22x   1x 1x                        
import { lazy, Suspense } from 'react'
 
export function LazyLoader({
  factory,
}: {
  factory: () => Promise<{ default: React.ComponentType<unknown> }>
}) {
  const Component = lazy(factory)
  return (
    <Suspense
      fallback={
        <div className="flex min-h-screen items-center justify-center">
          <p className="text-muted-foreground">Loading...</p>
        </div>
      }
    >
      <Component />
    </Suspense>
  )
}