// // Copyright 2023 DXOS.org // import React, { captureOwnerStack, useEffect, useState } from 'react'; import { mx } from '@dxos/ui-theme'; import { safeStringify } from '@dxos/util'; import { ErrorStack, parseCaptureOwnerStack } from '../components'; export type LoadingProps = { data?: any }; /** * Storybook loading component. */ export const Loading = ({ data }: LoadingProps) => { const [visible, setVisible] = useState(false); const ownerFrames = parseCaptureOwnerStack(captureOwnerStack()); useEffect(() => { const t = setTimeout(() => setVisible(true), 500); return () => clearTimeout(t); }, []); return (
{safeStringify(data, undefined, 2)}
No owner stack (production build or unsupported context).
)}