diff --git a/src/commands/devbox/list.tsx b/src/commands/devbox/list.tsx index fbd73650..15b3535c 100644 --- a/src/commands/devbox/list.tsx +++ b/src/commands/devbox/list.tsx @@ -558,8 +558,12 @@ const ListDevboxesUI = ({ onBack={() => { setShowCreate(false); }} - onCreate={() => { + onCreate={(devbox) => { setShowCreate(false); + // Navigate to the newly created devbox's detail page + if (onNavigateToDetail) { + onNavigateToDetail(devbox.id); + } }} /> ); diff --git a/src/screens/DevboxCreateScreen.tsx b/src/screens/DevboxCreateScreen.tsx index 7b96d627..1ed0b693 100644 --- a/src/screens/DevboxCreateScreen.tsx +++ b/src/screens/DevboxCreateScreen.tsx @@ -3,15 +3,16 @@ * Refactored from components/DevboxCreatePage.tsx */ import React from "react"; +import type { DevboxView } from "@runloop/api-client/resources/devboxes/devboxes"; import { useNavigation } from "../store/navigationStore.js"; import { DevboxCreatePage } from "../components/DevboxCreatePage.js"; export function DevboxCreateScreen() { - const { goBack } = useNavigation(); + const { goBack, navigate } = useNavigation(); - const handleCreate = () => { - // After creation, go back to list (which will refresh) - goBack(); + const handleCreate = (devbox: DevboxView) => { + // After creation, navigate to the devbox detail page + navigate("devbox-detail", { devboxId: devbox.id }); }; return ; diff --git a/tests/__mocks__/signal-exit.ts b/tests/__mocks__/signal-exit.ts index 59210cdf..45368b1f 100644 --- a/tests/__mocks__/signal-exit.ts +++ b/tests/__mocks__/signal-exit.ts @@ -7,3 +7,4 @@ const noop = () => () => {}; export default noop; export const onExit = noop; +