Space Manager: navigate to space list after hitting Save
This commit is contained in:
@@ -57,7 +57,9 @@ export function SpaceEditor({
|
||||
// screen, so its remaining settings are one step away rather than
|
||||
// behind another round trip through the list.
|
||||
onSaved={(savedId) =>
|
||||
navigate(id ? spacesUrl("/") : spacesUrl(`/${encodeURIComponent(savedId)}`))
|
||||
navigate(
|
||||
id ? spacesUrl("/") : spacesUrl(`/${encodeURIComponent(savedId)}`),
|
||||
)
|
||||
}
|
||||
onDeleted={() => navigate(spacesUrl("/"))}
|
||||
onUnauthorized={onUnauthorized}
|
||||
|
||||
@@ -75,9 +75,8 @@ export function SpaceForm({
|
||||
);
|
||||
// Matches the server's own `runtimeApi` default for a fresh space.
|
||||
const [runtimeApi, setRuntimeApi] = useState(initial?.runtimeApi ?? true);
|
||||
const [runtimeAvailability, setRuntimeAvailability] = useState<
|
||||
RuntimeAvailability | null
|
||||
>(null);
|
||||
const [runtimeAvailability, setRuntimeAvailability] =
|
||||
useState<RuntimeAvailability | null>(null);
|
||||
const [indexPage, setIndexPage] = useState(initial?.indexPage ?? "index");
|
||||
const [errors, setErrors] = useState<FieldError[]>([]);
|
||||
// Only ever "saving": a successful save navigates away — to the space list
|
||||
@@ -149,9 +148,8 @@ export function SpaceForm({
|
||||
.then((info) => setRuntimeAvailability(info.runtimeApi))
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
const runtimeApiUnavailable = runtimeApiUnavailableReason(
|
||||
runtimeAvailability,
|
||||
);
|
||||
const runtimeApiUnavailable =
|
||||
runtimeApiUnavailableReason(runtimeAvailability);
|
||||
|
||||
return (
|
||||
<form
|
||||
|
||||
@@ -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
|
||||
// form they have to take on trust.
|
||||
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 ({
|
||||
|
||||
Reference in New Issue
Block a user