mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 01:51:12 -05:00
feat: Implement optimistic UI updates
This commit is contained in:
@@ -425,6 +425,16 @@ export const QueueItem = memo(({
|
|||||||
<ListTree className={isMobile ? "w-5 h-5 mr-2" : "w-4 h-4 mr-2"} />
|
<ListTree className={isMobile ? "w-5 h-5 mr-2" : "w-4 h-4 mr-2"} />
|
||||||
Review Items
|
Review Items
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
{/* Debug info in dev mode */}
|
||||||
|
{import.meta.env.DEV && isAdmin && (
|
||||||
|
<div className="text-xs text-muted-foreground mb-2 font-mono">
|
||||||
|
🔍 isLockedByMe={String(isLockedByMe)} |
|
||||||
|
assigned_to={item.assigned_to?.slice(0,8) || 'null'} |
|
||||||
|
currentLock={currentLockSubmissionId?.slice(0,8) || 'null'}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{isAdmin && isLockedByMe && (
|
{isAdmin && isLockedByMe && (
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ export function useModerationQueueManager(config: ModerationQueueManagerConfig):
|
|||||||
onLockStateChange: () => {
|
onLockStateChange: () => {
|
||||||
logger.log('🔄 Lock state changed, invalidating queue cache');
|
logger.log('🔄 Lock state changed, invalidating queue cache');
|
||||||
queueQuery.invalidate();
|
queueQuery.invalidate();
|
||||||
|
// Force immediate re-render by triggering a loading cycle
|
||||||
|
setLoadingState(prev => prev === "loading" ? "ready" : prev);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const entityCache = useEntityCache();
|
const entityCache = useEntityCache();
|
||||||
|
|||||||
@@ -452,7 +452,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
|||||||
}, [currentLock, releaseLock]);
|
}, [currentLock, releaseLock]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentLock,
|
currentLock, // Exposed for reactive UI updates
|
||||||
queueStats,
|
queueStats,
|
||||||
isLoading,
|
isLoading,
|
||||||
claimNext,
|
claimNext,
|
||||||
|
|||||||
Reference in New Issue
Block a user