Page MenuHomePhabricator

Consolidate Duplicate Search Component Logic
Closed, ResolvedPublic

Description

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:

  1. Create new generic component: src/components/search/generic-search.tsx.
  2. Analyze both existing components to identify differences
  3. Create configurable interfaces for different search types
  4. Update src/components/searchComponent.tsx to use the new generic component
  5. Update src/components/compare/searchComponent.tsx to use the new generic component
  6. Test on /actors and /compare pages
  7. Verify all search functionality works

Details

Event Timeline

Change #1217857 had a related patch set uploaded (by Bovimacoco; author: Bovimacoco):

[labs/tools/WdTmCollab@main] Consolidate Duplicate Search Component Logic

https://gerrit.wikimedia.org/r/1217857

Change #1217857 merged by jenkins-bot:

[labs/tools/WdTmCollab@main] Consolidate duplicate search component logic

https://gerrit.wikimedia.org/r/1217857