diff --git a/packages/sanity/src/structure/__workshop__/LoadingPaneStory.tsx b/packages/sanity/src/structure/__workshop__/LoadingPaneStory.tsx new file mode 100644 index 00000000000..ca181b8d9f9 --- /dev/null +++ b/packages/sanity/src/structure/__workshop__/LoadingPaneStory.tsx @@ -0,0 +1,19 @@ +import {Card, Stack, Text} from '@sanity/ui' + +import {PaneLayout} from '../components' +import {LoadingPane} from '../panes' + +export default function LoadingPaneStory() { + return ( + + + + Note: This is intentionally not resolving. We're testing the loading pane! + + + + + + + ) +} diff --git a/packages/sanity/src/structure/__workshop__/index.ts b/packages/sanity/src/structure/__workshop__/index.ts index e73fd89c812..13bb69ff1e2 100644 --- a/packages/sanity/src/structure/__workshop__/index.ts +++ b/packages/sanity/src/structure/__workshop__/index.ts @@ -15,5 +15,10 @@ export default defineScope({ title: 'Document state', component: lazy(() => import('./DocumentStateStory')), }, + { + name: 'loading-pane', + title: 'Loading pane', + component: lazy(() => import('./LoadingPaneStory')), + }, ], }) diff --git a/packages/sanity/src/structure/panes/loading/LoadingPane.tsx b/packages/sanity/src/structure/panes/loading/LoadingPane.tsx index b90b68753b2..a2ec6c80b6f 100644 --- a/packages/sanity/src/structure/panes/loading/LoadingPane.tsx +++ b/packages/sanity/src/structure/panes/loading/LoadingPane.tsx @@ -61,12 +61,12 @@ export const LoadingPane = memo((props: LoadingPaneProps) => { const [currentMessage, setCurrentMessage] = useState(() => { if (typeof resolvedMessage === 'string') return resolvedMessage - return DEFAULT_MESSAGE_KEY + return t(DEFAULT_MESSAGE_KEY) }) useEffect(() => { if (typeof resolvedMessage !== 'object') return undefined - if (typeof resolvedMessage.subscribe === 'function') return undefined + if (typeof resolvedMessage.subscribe !== 'function') return undefined const sub = resolvedMessage.subscribe((message) => { setCurrentMessage('messageKey' in message ? t(message.messageKey) : message.message)