mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-29 22:17:13 +02:00
fix: show turn activity panel immediately when run starts
The panel was only emitted as a DisplayItem when classified thinking messages existed. During most of the turn, thinking messages haven't been reclassified yet, so the panel appeared late with all activities already populated. Two fixes: - After the message loop, inject a turn-activity item for any active run that wasn't already attached to a thinking group. This makes the panel appear as soon as the run record exists. - Remove the guard that required run events to exist before rendering. The panel now shows in its 'Working' state immediately when the run starts, and populates progressively as events arrive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -273,17 +273,16 @@ export function TurnActivityPanel({
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const wasActiveRef = useRef(isActive);
|
||||
|
||||
// Auto-expand when the turn is active and activity appears.
|
||||
// Auto-expand when the turn is active (run exists or thinking arrives).
|
||||
// Auto-collapse once the turn finishes.
|
||||
useEffect(() => {
|
||||
const hasActivity = thinkingMessages.length > 0 || (run?.events.length ?? 0) > 0;
|
||||
if (isActive && hasActivity) {
|
||||
if (isActive && (thinkingMessages.length > 0 || run)) {
|
||||
setExpanded(true);
|
||||
} else if (wasActiveRef.current && !isActive) {
|
||||
setExpanded(false);
|
||||
}
|
||||
wasActiveRef.current = isActive;
|
||||
}, [isActive, thinkingMessages.length, run?.events.length]);
|
||||
}, [isActive, thinkingMessages.length, run]);
|
||||
|
||||
const toggle = useCallback(() => setExpanded((prev) => !prev), []);
|
||||
|
||||
@@ -302,8 +301,8 @@ export function TurnActivityPanel({
|
||||
[thinkingMessages, run?.events],
|
||||
);
|
||||
|
||||
// Nothing to show yet
|
||||
if (thinkingMessages.length === 0 && (!run || run.events.length === 0)) {
|
||||
// Nothing to show — no thinking messages, no run, and not active
|
||||
if (thinkingMessages.length === 0 && !run) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user