Skip to content

fix: Search and Filter State Loss on Page Navigation (#194)#196

Open
nitishchaubeyy wants to merge 4 commits into
indresh404:mainfrom
nitishchaubeyy:fix/search-filter-persistence
Open

fix: Search and Filter State Loss on Page Navigation (#194)#196
nitishchaubeyy wants to merge 4 commits into
indresh404:mainfrom
nitishchaubeyy:fix/search-filter-persistence

Conversation

@nitishchaubeyy
Copy link
Copy Markdown
Contributor

Description

Resolves #194 by transitioning local component state to URL-parameter-based state management, ensuring complete persistence of user filters across page navigations.

Key Changes:

  • URL State Synchronization: Replaced standard useState for searchTerm and selectedLanguage with react-router-dom's useSearchParams. The component now strictly reads its initial state from the URL (?lang=Python&search=John).
  • Optimized History Stack: Implemented replace: true for the handleSearchChange input field to continuously update the URL query without polluting the browser's history stack with every single keystroke.
  • Persistent UX: When a user navigates to a developer's specific profile and clicks the browser "Back" button, the leaderboard will instantly remount with their exact previous search string and language filters applied, completely eliminating unnecessary data re-fetches and UX frustration.

Fixes #194

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 3, 2026 2:03pm

@github-actions github-actions Bot added bug Something isn't working frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 3, 2026
@indresh404
Copy link
Copy Markdown
Owner

merge conflict

@nitishchaubeyy
Copy link
Copy Markdown
Contributor Author

CI checks successful @indresh404

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 level:advanced level3 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Level 3] Search/Filter State Loss on Page Navigation (Context Persistence)

2 participants