-
Notifications
You must be signed in to change notification settings - Fork 0
Preserve Last Search Filters for Issues Page #876
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: main
Are you sure you want to change the base?
Preserve Last Search Filters for Issues Page #876
Conversation
This commit introduces a filter persistence mechanism for the Issues page. Key changes: - Search filters are now stored in `localStorage` whenever they are updated. - The "Back to Issues" link on the Issue Detail page now uses the stored filters to return the user to their previous view. - The "Issues" link in the sidebar also uses the stored filters. This change improves the user experience by preventing the loss of filter context when navigating between the Issues list and detail pages. Co-authored-by: timothyfroehlich <5819722+timothyfroehlich@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
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 implements filter persistence for the Issues page using localStorage, allowing users to return to their last-used filter state when navigating back from issue detail pages or via the sidebar. The implementation stores the full issues page path (including query parameters) whenever filters change and uses this stored path for navigation links.
Changes:
- Adds a new
useIssueLinkhook that retrieves the last used issues path from localStorage - Updates the sidebar "Issues" link to use the persisted path
- Replaces the hardcoded "Back to Issues" link with a new component that uses the persisted path
- Modifies
useSearchFiltersto store the path on every filter update
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/hooks/use-issue-link.ts |
New hook providing localStorage-based persistence for issues page path, with proper error handling and hydration-safe implementation |
src/hooks/use-search-filters.ts |
Integrates path storage into the existing filter update logic |
src/components/layout/Sidebar.tsx |
Updates Issues navigation link to use persisted path from useIssueLink hook |
src/components/issues/BackToIssuesLink.tsx |
New client component that replaces hardcoded back link with dynamic persisted path |
src/app/(app)/m/[initials]/i/[issueNumber]/page.tsx |
Replaces inline back link with BackToIssuesLink component |
| }): React.JSX.Element => { | ||
| const isActive = pathname === item.href; | ||
| const href = item.href === "/issues" ? issuesLink : item.href; | ||
| const isActive = pathname === href; |
Copilot
AI
Jan 29, 2026
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.
The isActive check will not work correctly when issuesLink contains query parameters. The pathname from usePathname() returns only the path (e.g., "/issues") without query parameters, but href may contain query parameters (e.g., "/issues?status=new"). This means the Issues link will never show as active when filters are present.
Consider comparing only the path portion of href, or checking if pathname starts with the base path for the Issues route.
| const isActive = pathname === href; | |
| const hrefPath = href.split("?")[0]; | |
| const isActive = pathname === hrefPath; |
|
|
||
| router.push(`${pathname}?${params.toString()}`); | ||
| const newPath = `${pathname}?${params.toString()}`; | ||
| storeLastIssuesPath(newPath); |
Copilot
AI
Jan 29, 2026
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.
The storeLastIssuesPath function is called unconditionally on every filter update, regardless of the current pathname. This means that if useSearchFilters is used on other pages in the future, it could incorrectly store non-issues paths.
Consider checking the pathname before storing: only call storeLastIssuesPath when pathname starts with "/issues".
| storeLastIssuesPath(newPath); | |
| if (pathname.startsWith("/issues")) { | |
| storeLastIssuesPath(newPath); | |
| } |
This change implements a filter persistence mechanism for the Issues page, ensuring that a user's search filters are preserved when navigating away and back to the page. It updates both the "Back to Issues" link and the sidebar navigation to use the stored filters from
localStorage.Fixes #856
PR created automatically by Jules for task 3579861091940212631 started by @timothyfroehlich