Skip to content

Commit 4332a45

Browse files
fix: switch to latest process
1 parent 55cb7bd commit 4332a45

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/hooks/useProcessEvents.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,16 @@ export function useProcessEvents(options: {
140140
// Reset tracking for this profile
141141
firstMcLogReceived.current.delete(payload.target_id);
142142
launchStartedForProfile.current.delete(payload.target_id);
143-
// Refetch processes to get the new running process
144-
fetchProcesses();
143+
// Refetch processes to get the new running process, then auto-switch to it
144+
const profileId = payload.target_id;
145+
fetchProcesses().then(() => {
146+
const newProcess = useProcessStore.getState().processes.find(
147+
p => p.profile_id === profileId
148+
);
149+
if (newProcess) {
150+
useProcessStore.getState().selectProcess(newProcess.id);
151+
}
152+
});
145153
}
146154

147155
// Handle error events

0 commit comments

Comments
 (0)