-
Notifications
You must be signed in to change notification settings - Fork 345
fix(metadata-view): show error state when exception is thrown #4270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughI pity the fool who misses this: when Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Content
participant Flag as metadataViewV2
participant View as CurrentView
participant Empty as EmptyView
User->>Content: open content explorer
Content->>Flag: check isMetadataViewV2Feature
Content->>View: read current view
alt Flag enabled AND View == VIEW_ERROR
Note over Content,Empty: New branch — V2 error handling
Content->>Empty: render EmptyView (isLoading=false)
else Other conditions
Content-->>User: render existing UI paths (unchanged)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/elements/content-explorer/__tests__/Content.test.tsx (3)
93-126: Solid coverage for V2 metadata path, fool!Good assertions that V2 disables the legacy MetadataBasedItemList and renders the new container. You could merge the two tests into one to cut redundancy, but it's fine as-is.
127-149: Brittle check for loading state — don’t trust copy strings, sucka.Asserting absence of the string “Please wait while the items load...” couples the test to UI copy. Prefer verifying the EmptyView prop instead by mocking the component and capturing isLoading.
Example:
+jest.mock('../common/empty-view', () => ({ + __esModule: true, + default: (props: any) => <div data-testid="empty-view-props">{JSON.stringify(props)}</div>, +})); ... - expect(screen.queryByText('Please wait while the items load...')).not.toBeInTheDocument(); + const props = JSON.parse(screen.getByTestId('empty-view-props').textContent!); + expect(props.isLoading).toBe(false);
150-159: Test name lies — tighten it up, fool.The test name says “does not render EmptyView,” but you only assert the error message isn’t present. Either assert on the component or rename and add a stronger check (e.g., ProgressBar present).
- test('does not render EmptyView when metadataViewV2 feature is enabled but view is not VIEW_ERROR', () => { + test('does not render the error EmptyView message when metadataViewV2 feature is enabled but view is not VIEW_ERROR', () => { ... - expect( - screen.queryByText('A network error has occurred while trying to load.'), - ).not.toBeInTheDocument(); + expect(screen.queryByText('A network error has occurred while trying to load.')).not.toBeInTheDocument(); + expect(screen.getByRole('progressbar')).toBeInTheDocument();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/elements/content-explorer/Content.tsx(1 hunks)src/elements/content-explorer/__tests__/Content.test.tsx(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: lint_test_build
- GitHub Check: Summary
🔇 Additional comments (1)
src/elements/content-explorer/Content.tsx (1)
83-83: Nice: explicit V2 error-state EmptyView with isLoading=false.This aligns the error UX for metadata view V2. Clean and targeted.
8a75dd7 to
4bc1d7c
Compare
4bc1d7c to
1d192be
Compare
|
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks: You can check the last failing draft PR here: #4291. You may have to fix your CI before adding the pull request to the queue again. |
|
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks: You can check the last failing draft PR here: #4292. You may have to fix your CI before adding the pull request to the queue again. |
Summary by CodeRabbit
Bug Fixes
UI
Tests