mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 20:11:12 -05:00
Fix queue refresh on lock state change
This commit is contained in:
@@ -111,7 +111,12 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
||||
},
|
||||
});
|
||||
|
||||
const queue = useModerationQueue();
|
||||
const queue = useModerationQueue({
|
||||
onLockStateChange: () => {
|
||||
logger.log('🔄 Lock state changed, invalidating queue cache');
|
||||
queueQuery.invalidate();
|
||||
}
|
||||
});
|
||||
const entityCache = useEntityCache();
|
||||
const profileCache = useProfileCache();
|
||||
|
||||
|
||||
@@ -21,7 +21,12 @@ interface QueueStats {
|
||||
avgWaitHours: number;
|
||||
}
|
||||
|
||||
export const useModerationQueue = () => {
|
||||
interface UseModerationQueueConfig {
|
||||
onLockStateChange?: () => void;
|
||||
}
|
||||
|
||||
export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
const { onLockStateChange } = config || {};
|
||||
const [currentLock, setCurrentLock] = useState<LockState | null>(null);
|
||||
const [queueStats, setQueueStats] = useState<QueueStats | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -158,6 +163,11 @@ export const useModerationQueue = () => {
|
||||
description: `${claimed.submission_type} submission (waiting ${formatInterval(claimed.waiting_time)})`,
|
||||
});
|
||||
|
||||
// Trigger refresh callback
|
||||
if (onLockStateChange) {
|
||||
onLockStateChange();
|
||||
}
|
||||
|
||||
return claimed.submission_id;
|
||||
} catch (error: any) {
|
||||
console.error('Error claiming submission:', error);
|
||||
@@ -239,6 +249,12 @@ export const useModerationQueue = () => {
|
||||
}
|
||||
|
||||
fetchStats();
|
||||
|
||||
// Trigger refresh callback
|
||||
if (onLockStateChange) {
|
||||
onLockStateChange();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -333,6 +349,11 @@ export const useModerationQueue = () => {
|
||||
description: 'You now have 15 minutes to review this submission',
|
||||
});
|
||||
|
||||
// Trigger refresh callback
|
||||
if (onLockStateChange) {
|
||||
onLockStateChange();
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
console.error('Error claiming submission:', error);
|
||||
|
||||
Reference in New Issue
Block a user