Domain: Coding
Difficulty: Difficult
Description:
The project has two nearly identical search components:
- src/components/searchComponent.tsx (for actors)
- src/components/compare/searchComponent.tsx (for movies)
These share 90% of the same logic but are separate files. This creates a maintenance burden and inconsistency. Refactor to:
- Create a generic <GenericSearch /> component that accepts configurable props
- Remove code duplication
- Support both actor and production searches
- Maintain all existing functionality
- Update all pages using these components to use the new generic component
Expected Outcome:
- Single reusable search component
- Reduced code duplication
- Easier maintenance
- All pages are still functional
- All existing features preserved
Setup Steps:
- Create new generic component: src/components/search/generic-search.tsx.
- Analyze both existing components to identify differences
- Create configurable interfaces for different search types
- Update src/components/searchComponent.tsx to use the new generic component
- Update src/components/compare/searchComponent.tsx to use the new generic component
- Test on /actors and /compare pages
- Verify all search functionality works