fix: refresh buttons use "now" as to-date for queries
Instead of calling refetch() with stale time params, the refresh buttons now set a toOverride state to new Date().toISOString(). This flows into the query key, triggering a fresh fetch with the current time as the upper bound. Both useApplicationLogs and useAgentEvents hooks accept an optional toOverride parameter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -223,8 +223,9 @@ function AgentPerformanceContent({ agent }: { agent: AgentInstance }) {
|
||||
export default function AgentHealth() {
|
||||
const { appId } = useParams();
|
||||
const { data: agents } = useAgents(undefined, appId);
|
||||
const { data: events, refetch: refetchEvents } = useAgentEvents(appId);
|
||||
const [eventSortAsc, setEventSortAsc] = useState(false);
|
||||
const [eventRefreshTo, setEventRefreshTo] = useState<string | undefined>();
|
||||
const { data: events } = useAgentEvents(appId, undefined, 50, eventRefreshTo);
|
||||
|
||||
const [selectedInstance, setSelectedInstance] = useState<AgentInstance | null>(null);
|
||||
const [panelOpen, setPanelOpen] = useState(false);
|
||||
@@ -509,7 +510,7 @@ export default function AgentHealth() {
|
||||
<button className={styles.sortBtn} onClick={() => setEventSortAsc((v) => !v)} title={eventSortAsc ? 'Oldest first' : 'Newest first'}>
|
||||
{eventSortAsc ? '\u2191' : '\u2193'}
|
||||
</button>
|
||||
<button className={styles.refreshBtn} onClick={() => refetchEvents()} title="Refresh">
|
||||
<button className={styles.refreshBtn} onClick={() => setEventRefreshTo(new Date().toISOString())} title="Refresh">
|
||||
↻
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user