mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:31:26 -05:00
Continue localStorage cleanup
This commit is contained in:
@@ -7,6 +7,7 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { logger } from '@/lib/logger';
|
||||
import * as storage from '@/lib/localStorage';
|
||||
import {
|
||||
Pagination,
|
||||
PaginationContent,
|
||||
@@ -123,15 +124,10 @@ export const ReportsQueue = forwardRef<ReportsQueueRef>((props, ref) => {
|
||||
|
||||
// Sort state with error handling
|
||||
const [sortConfig, setSortConfig] = useState<ReportSortConfig>(() => {
|
||||
try {
|
||||
const saved = localStorage.getItem('reportsQueue_sortConfig');
|
||||
if (saved) {
|
||||
return JSON.parse(saved);
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
logger.warn('Failed to load sort config from localStorage');
|
||||
}
|
||||
return { field: 'created_at', direction: 'asc' as ReportSortDirection };
|
||||
return storage.getJSON('reportsQueue_sortConfig', {
|
||||
field: 'created_at',
|
||||
direction: 'asc' as ReportSortDirection
|
||||
});
|
||||
});
|
||||
|
||||
// Get admin settings for polling configuration
|
||||
@@ -151,11 +147,7 @@ export const ReportsQueue = forwardRef<ReportsQueueRef>((props, ref) => {
|
||||
|
||||
// Persist sort configuration with error handling
|
||||
useEffect(() => {
|
||||
try {
|
||||
localStorage.setItem('reportsQueue_sortConfig', JSON.stringify(sortConfig));
|
||||
} catch (error: unknown) {
|
||||
logger.warn('Failed to save sort config to localStorage');
|
||||
}
|
||||
storage.setJSON('reportsQueue_sortConfig', sortConfig);
|
||||
}, [sortConfig]);
|
||||
|
||||
const fetchReports = async (silent = false) => {
|
||||
|
||||
Reference in New Issue
Block a user