fix: refresh agents on tab focus + hide stale nextRun + add cron logging
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 42s

- Add visibilitychange listener: refreshes agent data immediately when
  user returns to the tab (more reliable than interval-only polling)
- Only show toast for actions created within last 5 minutes to avoid
  false positives on page reload
- Hide "Prochaine exécution" line entirely if nextRun is in the past
  instead of showing confusing "En attente de déclenchement"
- Add detailed logging to cron endpoint for debugging

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 13:16:32 +02:00
parent f0999263a0
commit 9779dd7a79
3 changed files with 49 additions and 32 deletions

View File

@@ -197,14 +197,12 @@ export function AgentCard({ agent, onEdit, onRefresh, onToggle }: AgentCardProps
<span>{t('agents.metadata.executions', { count: agent._count.actions })}</span>
</div>
{agent.frequency !== 'manual' && agent.nextRun && (
{agent.frequency !== 'manual' && agent.nextRun && new Date(agent.nextRun) > new Date() && (
<div className="flex items-center gap-1.5 text-xs text-muted-foreground mb-3">
<Clock className="w-3 h-3" />
{t('agents.schedule.nextRun')}{' '}
{mounted
? new Date(agent.nextRun) > new Date()
? formatDistanceToNow(new Date(agent.nextRun), { addSuffix: true, locale: dateLocale })
: t('agents.schedule.pending')
? formatDistanceToNow(new Date(agent.nextRun), { addSuffix: true, locale: dateLocale })
: new Date(agent.nextRun).toISOString().split('T')[0]}
</div>
)}