Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
Fix: issue with cmd + s on status-page/new form (#916)
Priyank Rajaie8c5118159a4
diff --git a/apps/web/src/components/forms/status-page/form.tsx b/apps/web/src/components/forms/status-page/form.tsxindex 2f2a585b5..b95d96332 100644--- a/apps/web/src/components/forms/status-page/form.tsx+++ b/apps/web/src/components/forms/status-page/form.tsx@@ -117,29 +117,35 @@ export function StatusPageForm({const onSubmit = async ({ ...props }: InsertPage) => {startTransition(async () => {try {- if (defaultValues) {- await api.page.update.mutate(props);+ const isUnique = await checkUniqueSlug();+ if (!isUnique) {+ // the user will already have the "error" message - we include a toast as well+ toastAction("unique-slug");} else {- const page = await api.page.create.mutate(props);- const id = page?.id || null;- router.replace(`?${updateSearchParams({ id })}`); // to stay on same page and enable 'Advanced' tab- }+ if (defaultValues) {+ await api.page.update.mutate(props);+ } else {+ const page = await api.page.create.mutate(props);+ const id = page?.id || null;+ router.replace(`?${updateSearchParams({ id })}`); // to stay on same page and enable 'Advanced' tab+ }- toast.success("Saved successfully.", {- description: "Your status page is ready to go.",- action: {- label: "Visit",- onClick: () =>- window.open(`https://${props.slug}.openstatus.dev`, "_blank")- ?.location,- },- });- // otherwise, the form will stay dirty - keepValues is used to keep the current values in the form- form.reset({}, { keepValues: true });- if (nextUrl) {- router.push(nextUrl);+ toast.success("Saved successfully.", {+ description: "Your status page is ready to go.",+ action: {+ label: "Visit",+ onClick: () =>+ window.open(`https://${props.slug}.openstatus.dev`, "_blank")+ ?.location,+ },+ });+ // otherwise, the form will stay dirty - keepValues is used to keep the current values in the form+ form.reset({}, { keepValues: true });+ if (nextUrl) {+ router.push(nextUrl);+ }+ router.refresh();}- router.refresh();} catch {toastAction("error");}@@ -159,15 +165,7 @@ export function StatusPageForm({<formonSubmit={async (e) => {e.preventDefault();- const isUnique = await checkUniqueSlug();- if (!isUnique) {- // the user will already have the "error" message - we include a toast as well- toastAction("unique-slug");- } else {- if (onSubmit) {- void form.handleSubmit(onSubmit)(e);- }- }+ void form.handleSubmit(onSubmit)(e);}}className="grid w-full gap-6">