mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 17:11:13 -05:00
Fix sorting logic in moderation queue
This commit is contained in:
@@ -238,8 +238,9 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
|||||||
item_data,
|
item_data,
|
||||||
status
|
status
|
||||||
)
|
)
|
||||||
`,
|
`
|
||||||
)
|
);
|
||||||
|
|
||||||
// Apply user-selected sort configuration
|
// Apply user-selected sort configuration
|
||||||
const sortColumn = getSortColumn(sort.field);
|
const sortColumn = getSortColumn(sort.field);
|
||||||
const sortAscending = sort.direction === 'asc';
|
const sortAscending = sort.direction === 'asc';
|
||||||
@@ -307,6 +308,21 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
|||||||
const endIndex = pagination.endIndex;
|
const endIndex = pagination.endIndex;
|
||||||
submissionsQuery = submissionsQuery.range(startIndex, endIndex);
|
submissionsQuery = submissionsQuery.range(startIndex, endIndex);
|
||||||
|
|
||||||
|
// Log the final query for debugging
|
||||||
|
console.log('[Query] Final query about to execute:', {
|
||||||
|
sortApplied: sortColumn,
|
||||||
|
sortDirection: sortAscending ? 'ASC' : 'DESC',
|
||||||
|
filtersApplied: {
|
||||||
|
tab: filters.activeTab,
|
||||||
|
status: filters.debouncedStatusFilter,
|
||||||
|
entity: filters.debouncedEntityFilter,
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
startIndex,
|
||||||
|
endIndex
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const { data: submissions, error: submissionsError } = await submissionsQuery;
|
const { data: submissions, error: submissionsError } = await submissionsQuery;
|
||||||
|
|
||||||
if (submissionsError) throw submissionsError;
|
if (submissionsError) throw submissionsError;
|
||||||
@@ -485,7 +501,7 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
|||||||
setLoadingState("ready");
|
setLoadingState("ready");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[user, isAdmin, isSuperuser, filters, pagination, profileCache, entityCache, toast],
|
[user, isAdmin, isSuperuser, filters, pagination, profileCache, entityCache, toast, sort],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Store fetchItems in ref to avoid re-creating visibility listener
|
// Store fetchItems in ref to avoid re-creating visibility listener
|
||||||
|
|||||||
Reference in New Issue
Block a user