-
Notifications
You must be signed in to change notification settings - Fork 0
[BLOCKED] Refactor search module and improve cached search logic #1423
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
base: rc/v0.15.0
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Pull request overview
This PR refactors the search module by consolidating functionality from sections/search and the old modules/template-search into a unified modules/search structure. The refactoring improves architectural organization by moving UI components, state management, and business logic into a cohesive module following the codebase's established patterns. The cached search initialization logic is simplified by introducing a searchUseCases facade that uses createRoot for singleton initialization, consistent with other modules like authUseCases and dayUseCases.
Key Changes
- Consolidated template search functionality into
modules/searchwith proper separation of concerns (ui/, application/, infrastructure/, domain/) - Simplified cached search initialization by replacing separate
cachedSearchEffectsandcachedSearchCacheStorefiles with a unifiedsearchUseCasesfacade - Updated all import paths across the codebase to reference the new module structure
Reviewed changes
Copilot reviewed 24 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/sections/recipe/components/RecipeEditModal.tsx | Updated import path from sections/search to modules/search |
| src/sections/item/components/ItemView/ItemEdit/ItemEditModal.tsx | Updated import path from sections/search to modules/search |
| src/sections/day-diet/components/DayMeals.tsx | Updated import path from sections/search to modules/search |
| src/sections/common/components/buttons/RemoveFromRecentButton.tsx | Updated import path from modules/template-search to modules/search |
| src/sections/common/components/buttons/RemoveFromRecentButton.test.tsx | Deleted test file (section UI components are not typically tested in this codebase) |
| src/routes/test-app.tsx | Updated to use openTemplateSearchModal helper instead of manual modal setup |
| src/modules/search/ui/openTemplateSearchModal.tsx | Updated import to reference TemplateSearchModal from modules/search/ui |
| src/modules/search/ui/TemplateSearchTabs.tsx | New file - moved and consolidated from sections/search |
| src/modules/search/ui/TemplateSearchResults.tsx | Updated imports to use modules/search paths |
| src/modules/search/ui/TemplateSearchResultItem.tsx | New file - moved from sections/search with proper module imports |
| src/modules/search/ui/TemplateSearchModal.tsx | Updated imports to use modules/search and modules/search/application paths |
| src/modules/search/ui/TemplateSearchBar.tsx | Updated import from modules/template-search to modules/search |
| src/modules/search/ui/SearchLoadingIndicator.tsx | New file - moved from sections/search with inline loading indicator |
| src/modules/search/infrastructure/tests/templateSearchTabPreference.test.ts | Updated all imports to reference modules/search |
| src/modules/search/infrastructure/templateSearchTabPreference.ts | Updated import to use modules/search/ui path |
| src/modules/search/infrastructure/supabase/realtime.ts | Refactored to accept callbacks as parameters, removing direct cache store dependency |
| src/modules/search/infrastructure/signals/cachedSearchEffects.ts | Deleted - logic moved to searchUseCases |
| src/modules/search/infrastructure/signals/cachedSearchCacheStore.ts | Deleted - replaced by application/store/cachedSearchCacheStore.ts factory |
| src/modules/search/infrastructure/cachedSearchRepository.ts | Simplified by removing cache management logic (now in searchUseCases) |
| src/modules/search/application/usecases/tests/templateSearchLogic.test.ts | Updated imports to use modules/search paths |
| src/modules/search/application/usecases/templateSearchLogic.ts | Updated import to reference modules/search/ui |
| src/modules/search/application/usecases/searchUseCases.ts | New facade that encapsulates cached search initialization with createRoot pattern |
| src/modules/search/application/usecases/cachedSearchCrud.ts | Refactored to export factory function instead of direct repository usage |
| src/modules/search/application/store/templateSearchState.ts | Updated imports from modules/template-search to modules/search |
| src/modules/search/application/store/cachedSearchCacheStore.ts | New factory function replacing the old signal-based store |
| src/modules/diet/food/infrastructure/api/application/apiFood.ts | Updated to use searchUseCases instead of direct cachedSearchCrud import |
| src/modules/diet/food/application/usecases/foodCrud.ts | Updated to use searchUseCases instead of direct cachedSearchCrud import |
Restructure the search module for better organization, consolidate template search functionality, and simplify the initialization of cached search logic. Encapsulate cached search operations to enhance maintainability and clarity.
BLOCKED BY: