mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 11:51:14 -05:00
Fix moderation queue sorting
This commit is contained in:
@@ -223,7 +223,12 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
|||||||
`,
|
`,
|
||||||
)
|
)
|
||||||
.order("escalated", { ascending: false })
|
.order("escalated", { ascending: false })
|
||||||
.order("created_at", { ascending: true });
|
.order(
|
||||||
|
sort.config.field === 'created_at' ? 'submitted_at' :
|
||||||
|
sort.config.field === 'username' ? 'user_id' :
|
||||||
|
sort.config.field,
|
||||||
|
{ ascending: sort.config.direction === 'asc' }
|
||||||
|
);
|
||||||
|
|
||||||
// Apply tab-based status filtering
|
// Apply tab-based status filtering
|
||||||
const tab = filters.activeTab;
|
const tab = filters.activeTab;
|
||||||
@@ -452,7 +457,7 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
|||||||
setLoadingState("ready");
|
setLoadingState("ready");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[user, isAdmin, isSuperuser, filters, pagination, profileCache, entityCache, toast],
|
[user, isAdmin, isSuperuser, filters, pagination, sort, profileCache, entityCache, toast],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Store fetchItems in ref to avoid re-creating visibility listener
|
// Store fetchItems in ref to avoid re-creating visibility listener
|
||||||
@@ -788,6 +793,14 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
|||||||
fetchItems(true);
|
fetchItems(true);
|
||||||
}, [filters.debouncedEntityFilter, filters.debouncedStatusFilter]);
|
}, [filters.debouncedEntityFilter, filters.debouncedStatusFilter]);
|
||||||
|
|
||||||
|
// Sort changes trigger refetch
|
||||||
|
useEffect(() => {
|
||||||
|
if (!user || !initialFetchCompleteRef.current || isMountingRef.current) return;
|
||||||
|
|
||||||
|
pagination.reset();
|
||||||
|
fetchItems(true);
|
||||||
|
}, [sort.config.field, sort.config.direction]);
|
||||||
|
|
||||||
// Pagination changes trigger refetch
|
// Pagination changes trigger refetch
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!user || !initialFetchCompleteRef.current || pagination.currentPage === 1) return;
|
if (!user || !initialFetchCompleteRef.current || pagination.currentPage === 1) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user