Skip to content

Commit 731681f

Browse files
authored
feat(devbox): navigates to devbox detail after create (#22)
1 parent 9b46c74 commit 731681f

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/commands/devbox/list.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,12 @@ const ListDevboxesUI = ({
558558
onBack={() => {
559559
setShowCreate(false);
560560
}}
561-
onCreate={() => {
561+
onCreate={(devbox) => {
562562
setShowCreate(false);
563+
// Navigate to the newly created devbox's detail page
564+
if (onNavigateToDetail) {
565+
onNavigateToDetail(devbox.id);
566+
}
563567
}}
564568
/>
565569
);

src/screens/DevboxCreateScreen.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
* Refactored from components/DevboxCreatePage.tsx
44
*/
55
import React from "react";
6+
import type { DevboxView } from "@runloop/api-client/resources/devboxes/devboxes";
67
import { useNavigation } from "../store/navigationStore.js";
78
import { DevboxCreatePage } from "../components/DevboxCreatePage.js";
89

910
export function DevboxCreateScreen() {
10-
const { goBack } = useNavigation();
11+
const { goBack, navigate } = useNavigation();
1112

12-
const handleCreate = () => {
13-
// After creation, go back to list (which will refresh)
14-
goBack();
13+
const handleCreate = (devbox: DevboxView) => {
14+
// After creation, navigate to the devbox detail page
15+
navigate("devbox-detail", { devboxId: devbox.id });
1516
};
1617

1718
return <DevboxCreatePage onBack={goBack} onCreate={handleCreate} />;

tests/__mocks__/signal-exit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ const noop = () => () => {};
77
export default noop;
88
export const onExit = noop;
99

10+

0 commit comments

Comments
 (0)