Space Manager: navigate to space list after hitting Save

This commit is contained in:
Zef Hemel
2026-07-31 15:40:55 +02:00
parent e9ff819735
commit 992f2617ec
3 changed files with 10 additions and 8 deletions
+3 -1
View File
@@ -57,7 +57,9 @@ export function SpaceEditor({
// screen, so its remaining settings are one step away rather than // screen, so its remaining settings are one step away rather than
// behind another round trip through the list. // behind another round trip through the list.
onSaved={(savedId) => onSaved={(savedId) =>
navigate(id ? spacesUrl("/") : spacesUrl(`/${encodeURIComponent(savedId)}`)) navigate(
id ? spacesUrl("/") : spacesUrl(`/${encodeURIComponent(savedId)}`),
)
} }
onDeleted={() => navigate(spacesUrl("/"))} onDeleted={() => navigate(spacesUrl("/"))}
onUnauthorized={onUnauthorized} onUnauthorized={onUnauthorized}
+4 -6
View File
@@ -75,9 +75,8 @@ export function SpaceForm({
); );
// Matches the server's own `runtimeApi` default for a fresh space. // Matches the server's own `runtimeApi` default for a fresh space.
const [runtimeApi, setRuntimeApi] = useState(initial?.runtimeApi ?? true); const [runtimeApi, setRuntimeApi] = useState(initial?.runtimeApi ?? true);
const [runtimeAvailability, setRuntimeAvailability] = useState< const [runtimeAvailability, setRuntimeAvailability] =
RuntimeAvailability | null useState<RuntimeAvailability | null>(null);
>(null);
const [indexPage, setIndexPage] = useState(initial?.indexPage ?? "index"); const [indexPage, setIndexPage] = useState(initial?.indexPage ?? "index");
const [errors, setErrors] = useState<FieldError[]>([]); const [errors, setErrors] = useState<FieldError[]>([]);
// Only ever "saving": a successful save navigates away — to the space list // Only ever "saving": a successful save navigates away — to the space list
@@ -149,9 +148,8 @@ export function SpaceForm({
.then((info) => setRuntimeAvailability(info.runtimeApi)) .then((info) => setRuntimeAvailability(info.runtimeApi))
.catch(() => {}); .catch(() => {});
}, []); }, []);
const runtimeApiUnavailable = runtimeApiUnavailableReason( const runtimeApiUnavailable =
runtimeAvailability, runtimeApiUnavailableReason(runtimeAvailability);
);
return ( return (
<form <form
+3 -1
View File
@@ -149,7 +149,9 @@ test("saving an existing space returns to the list showing the change", async ({
// they just edited carrying its new name, rather than an unchanged-looking // they just edited carrying its new name, rather than an unchanged-looking
// form they have to take on trust. // form they have to take on trust.
await expect(page).toHaveURL(`${base}/.spaces/`); await expect(page).toHaveURL(`${base}/.spaces/`);
await expect(page.getByRole("link", { name: "Feedback Renamed" })).toBeVisible(); await expect(
page.getByRole("link", { name: "Feedback Renamed" }),
).toBeVisible();
}); });
test("the shell allow list is editable, and only shown when shell is enabled", async ({ test("the shell allow list is editable, and only shown when shell is enabled", async ({