mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 12:11:11 -05:00
Fix: Remove sort text and fix sorting logic
This commit is contained in:
@@ -48,11 +48,6 @@ export const QueueSortControls = ({
|
||||
Sort By
|
||||
</Label>
|
||||
)}
|
||||
<div className="flex items-center gap-2 text-xs text-muted-foreground mb-1">
|
||||
<span>
|
||||
Sorting by {getSortFieldLabel(sortConfig.field)} ({sortConfig.direction === 'asc' ? '↑ Ascending' : '↓ Descending'})
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Select
|
||||
value={sortConfig.field}
|
||||
|
||||
@@ -103,16 +103,6 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
||||
initialConfig: { field: "created_at", direction: "asc" },
|
||||
persist: true,
|
||||
storageKey: "moderationQueue_sortConfig",
|
||||
onChange: useCallback((config: SortConfig) => {
|
||||
if (!user || !initialFetchCompleteRef.current || isMountingRef.current) {
|
||||
console.log('[Sort onChange] Skipped:', { user: !!user, initialFetch: initialFetchCompleteRef.current, mounting: isMountingRef.current });
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[Sort onChange] Triggered - Refetching with:', config);
|
||||
pagination.reset();
|
||||
fetchItemsRef.current?.(true);
|
||||
}, [user]),
|
||||
});
|
||||
|
||||
const queue = useModerationQueue();
|
||||
@@ -814,6 +804,16 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
||||
fetchItems(true);
|
||||
}, [filters.debouncedEntityFilter, filters.debouncedStatusFilter]);
|
||||
|
||||
// Sort changes trigger refetch
|
||||
useEffect(() => {
|
||||
if (!user || !initialFetchCompleteRef.current || isMountingRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[Sort Change] Refetching with:', sort.field, sort.direction);
|
||||
pagination.reset();
|
||||
fetchItemsRef.current?.(true);
|
||||
}, [sort.field, sort.direction, user, pagination.reset]);
|
||||
|
||||
// Pagination changes trigger refetch
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user