mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:31:26 -05:00
Implement Phase 2 improvements
This commit is contained in:
@@ -121,15 +121,15 @@ export const ReportsQueue = forwardRef<ReportsQueueRef>((props, ref) => {
|
||||
const [totalCount, setTotalCount] = useState(0);
|
||||
const totalPages = Math.ceil(totalCount / pageSize);
|
||||
|
||||
// Sort state
|
||||
// Sort state with error handling
|
||||
const [sortConfig, setSortConfig] = useState<ReportSortConfig>(() => {
|
||||
const saved = localStorage.getItem('reportsQueue_sortConfig');
|
||||
if (saved) {
|
||||
try {
|
||||
try {
|
||||
const saved = localStorage.getItem('reportsQueue_sortConfig');
|
||||
if (saved) {
|
||||
return JSON.parse(saved);
|
||||
} catch {
|
||||
return { field: 'created_at', direction: 'asc' as ReportSortDirection };
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load sort config from localStorage:', error);
|
||||
}
|
||||
return { field: 'created_at', direction: 'asc' as ReportSortDirection };
|
||||
});
|
||||
@@ -149,9 +149,13 @@ export const ReportsQueue = forwardRef<ReportsQueueRef>((props, ref) => {
|
||||
refresh: () => fetchReports(false) // Manual refresh shows loading
|
||||
}), []);
|
||||
|
||||
// Persist sort configuration
|
||||
// Persist sort configuration with error handling
|
||||
useEffect(() => {
|
||||
localStorage.setItem('reportsQueue_sortConfig', JSON.stringify(sortConfig));
|
||||
try {
|
||||
localStorage.setItem('reportsQueue_sortConfig', JSON.stringify(sortConfig));
|
||||
} catch (error) {
|
||||
console.warn('Failed to save sort config to localStorage:', error);
|
||||
}
|
||||
}, [sortConfig]);
|
||||
|
||||
const fetchReports = async (silent = false) => {
|
||||
|
||||
Reference in New Issue
Block a user