Skip to content

Commit 246f2df

Browse files
fix(metadata-view): show error state when exception is thrown (#4270)
fix(metadata-view): show error state when exception is thrown in metdataview v2
1 parent 8453128 commit 246f2df

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/elements/content-explorer/Content.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const Content = ({
8080
{view === VIEW_ERROR || view === VIEW_SELECTED ? null : <ProgressBar percent={percentLoaded} />}
8181

8282
{!isMetadataViewV2Feature && isViewEmpty && <EmptyView view={view} isLoading={percentLoaded !== 100} />}
83+
{isMetadataViewV2Feature && view === VIEW_ERROR && <EmptyView view={view} isLoading={false} />}
8384
{!isMetadataViewV2Feature && !isViewEmpty && isMetadataBasedView && (
8485
<MetadataBasedItemList
8586
currentCollection={currentCollection}

src/elements/content-explorer/MetadataViewContainer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ const MetadataViewContainer = ({
140140
id: FIELD_ITEM_NAME,
141141
isItemMetadata: true,
142142
isRowHeader: true,
143-
minWidth: 250,
144-
maxWidth: 250,
143+
minWidth: 300,
145144
textValue: formatMessage(messages.name),
146145
type: 'string',
147146
},

src/elements/content-explorer/__tests__/Content.test.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('Content Component', () => {
9090
expect(screen.getByLabelText('File')).toBeInTheDocument();
9191
});
9292

93-
describe('contentExplorer.metadataViewV2 feature', () => {
93+
describe('MetadataView V2 feature', () => {
9494
const features = {
9595
contentExplorer: { metadataViewV2: true },
9696
};
@@ -123,5 +123,31 @@ describe('Content Component', () => {
123123

124124
expect(screen.getByText('MetadataViewContainer')).toBeInTheDocument();
125125
});
126+
127+
describe('EmptyView rendering for VIEW_ERROR with metadataViewV2 feature', () => {
128+
test('renders EmptyView with isLoading=false when metadataViewV2 feature is enabled and view is VIEW_ERROR', () => {
129+
// This test verifies that the EmptyView receives isLoading={false}
130+
// We can verify this by checking that the loading message is not shown
131+
renderComponent({
132+
features,
133+
view: VIEW_ERROR,
134+
});
135+
136+
// Should show error message, not loading message
137+
expect(screen.getByText('A network error has occurred while trying to load.')).toBeInTheDocument();
138+
expect(screen.queryByText('Please wait while the items load...')).not.toBeInTheDocument();
139+
});
140+
141+
test('does not render EmptyView when metadataViewV2 feature is enabled but view is not VIEW_ERROR', () => {
142+
renderComponent({
143+
features,
144+
view: VIEW_FOLDER,
145+
});
146+
147+
expect(
148+
screen.queryByText('A network error has occurred while trying to load.'),
149+
).not.toBeInTheDocument();
150+
});
151+
});
126152
});
127153
});

0 commit comments

Comments
 (0)