This commit modifies the test files for the CreateAppModal component to replace exact string matches with regular expressions for button role queries. This change enhances the robustness of the tests by allowing for more flexible matching of button names, ensuring they remain valid even if the text changes slightly in the future. Additionally, type assertions were improved in the CreateAppModal tests to enhance type safety.
This commit refactors the document actions and metadata components to enhance code clarity and maintainability. Key changes include:
- Simplified the hook by removing unnecessary type assertions.
- Streamlined the rendering logic in the component by consolidating JSX elements.
- Updated dependencies in the hook to ensure proper reactivity.
These adjustments aim to improve the overall structure and performance of the document management features.
This commit refactors the metadata components within the document detail section by extracting and organizing them into separate files for better maintainability and readability. The following components were created or modified:
- DocTypeSelector: A new component for selecting document types.
- FieldInfo: A new component for displaying and editing field information.
- IconButton: A new component for rendering document type icons.
- MetadataFieldList: A new component for rendering a list of metadata fields.
- TypeIcon: A new component for displaying icons based on document types.
- Utility functions for mapping options.
Additionally, comprehensive tests were added for each new component to ensure functionality and reliability.
Extract reusable hooks and sub-components from the DocumentList component
to reduce complexity and improve testability:
- useDocumentSort: handles sorting state and logic
- useDocumentSelection: manages document selection state
- useDocumentActions: handles batch actions with React Query mutations
- DocumentTableRow: extracted table row component
- SortHeader: reusable sort header component
- DocumentSourceIcon: data source type icon renderer
- renderTdValue: utility for displaying formatted values
The main component remains in list.tsx with document-list/index.tsx
providing a re-export for backwards compatibility.
Test coverage: 156 tests covering all extracted modules.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Refactor the EmbeddingDetail component to improve maintainability:
- Extract useEmbeddingStatus hook with React Query for status polling
- Extract usePauseIndexing and useResumeIndexing mutation hooks
- Split UI into StatusHeader, ProgressBar, SegmentProgress, RuleDetail components
- Add comprehensive tests with 98.57% statement coverage
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>