Skip to content

Commit

Permalink
feat(sanity): add "Copy error details" button to document list error UI
Browse files Browse the repository at this point in the history
  • Loading branch information
juice49 committed Sep 24, 2024
1 parent 023aea4 commit 71919a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
2 changes: 0 additions & 2 deletions packages/sanity/src/structure/i18n/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,6 @@ const structureLocaleStrings = defineLocalesResources('structure', {
'panes.document-header-title.new.text': 'New {{schemaType}}',
/** The text used in the document header title if no other title can be determined */
'panes.document-header-title.untitled.text': 'Untitled',
/** The text for the retry button on the document list pane */
'panes.document-list-pane.error.retry-button.text': 'Retry',
/** The error text on the document list pane */
'panes.document-list-pane.error.text': 'Error: <Code>{{error}}</Code>',
/** The error title on the document list pane */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {SyncIcon} from '@sanity/icons'
import {type SanityDocument} from '@sanity/types'
import {Box, Container, Flex, Heading, Stack, Text} from '@sanity/ui'
import {useCallback, useEffect, useMemo, useState} from 'react'
import {
CommandList,
type CommandListRenderItemCallback,
ErrorActions,
type GeneralPreviewLayoutKey,
getPublishedId,
LoadingBlock,
Expand All @@ -15,7 +15,6 @@ import {
} from 'sanity'
import {styled} from 'styled-components'

import {Button} from '../../../ui-components'
import {Delay, PaneContent, PaneItem, usePane, usePaneLayout} from '../../components'
import {structureLocaleNamespace} from '../../i18n'
import {FULL_LIST_LIMIT} from './constants'
Expand Down Expand Up @@ -198,17 +197,7 @@ export function DocumentListPaneContent(props: DocumentListPaneContentProps) {
components={{Code: ({children}) => <code>{children}</code>}}
/>
</Text>

{onRetry && (
<Box>
<Button
icon={SyncIcon}
onClick={onRetry}
text={t('panes.document-list-pane.error.retry-button.text')}
tone="primary"
/>
</Box>
)}
<ErrorActions error={error} eventId={null} onRetry={onRetry} />
</Stack>
</Container>
</Flex>
Expand Down

0 comments on commit 71919a3

Please sign in to comment.