refactor: implement component architecture and custom hooks#3
Open
modojodo wants to merge 1 commit intorefactor/nextjs-app-router-patternsfrom
Open
refactor: implement component architecture and custom hooks#3modojodo wants to merge 1 commit intorefactor/nextjs-app-router-patternsfrom
modojodo wants to merge 1 commit intorefactor/nextjs-app-router-patternsfrom
Conversation
- Extract reusable logic into custom hooks (useAdvocates, useAdvocateFilters, useSearchParams) - Break down large components into focused sub-components - Add URL search params for shareable links and state persistence - Implement proper loading, error, and empty states - Create reusable table header components (SortableHeader, StaticHeader) - Add clear search button for better UX - Document server-side improvements in DISCUSSION.md - Remove unused variables and clean up imports Improves maintainability, reusability, and user experience while keeping client-side filtering approach for current dataset size.
af9daaf to
62d5c64
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #2
Component Architecture & Custom Hooks Refactor
Overview
This PR refactors the advocate search functionality into a clean, maintainable component architecture with custom hooks and improved user experience.
Key Changes
Component Architecture
SearchFilters,AdvocateTable,LoadingState,ErrorState,EmptyStateSortableHeaderandStaticHeadercomponentsCustom Hooks
useAdvocates: Data fetching with loading/error statesuseAdvocateFilters: Client-side filtering, sorting, and search logicuseSearchParams: URL parameter management and updatesURL State Management
router.replace()for smooth navigationUser Experience
Benefits
Documentation
Added comprehensive
DISCUSSION.mddocumenting server-side improvements for future scale with hundreds of thousands of advocates.