-
Notifications
You must be signed in to change notification settings - Fork 42
feat: persist marketplace sort and filter choices across sessions (Closes #125) #300
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| 'use client'; | ||
|
|
||
| import { useMemo, useState } from 'react'; | ||
| import { useMemo } from 'react'; | ||
| import { Search, LayoutGrid } from 'lucide-react'; | ||
| import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
|
|
||
| import { Input } from '@/components/ui/input'; | ||
| import { AuthGuard } from '@/components/auth/AuthGuard'; | ||
| import { useLocalStorage } from '@/hooks/useLocalStorage'; | ||
| import { MarketplaceCard } from '@/components/marketplace/MarketplaceCard'; | ||
| import { MarketplaceTabs } from '@/components/marketplace/MarketplaceTabs'; | ||
| import { SuggestedMatches } from '@/components/marketplace/SuggestedMatches'; | ||
|
|
@@ -40,8 +41,8 @@ const SORT_OPTIONS: { value: SortKey; label: string }[] = [ | |
|
|
||
| function MarketplacePageInner() { | ||
| const [search, setSearch] = useState(''); | ||
| const [filters, setFilters] = useState<Filters>({ currency: 'ALL', status: 'ALL' }); | ||
| const [sort, setSort] = useState<SortKey>('newest'); | ||
| const [filters, setFilters] = useLocalStorage<Filters>('marketplace-filters', { currency: 'ALL', status: 'ALL' }); | ||
| const [sort, setSort] = useLocalStorage<SortKey>('marketplace-sort', 'newest'); | ||
|
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Remove storage keys when selections are cleared. When the user clears filters by selecting 🤖 Prompt for AI Agents🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Validate persisted values before exposing them to the page.
🤖 Prompt for AI Agents |
||
|
|
||
| /** | ||
| * View mode: | ||
|
|
||
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.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Restore
useStatein the React import.MarketplacePageInnerstill callsuseStateat Line 43 and Line 52, but this import only includesuseMemo. The TypeScript build fails becauseuseStateis undefined.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents