Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Instant save on demo instance

Andras Bacsai26eacfc2c05f
diff --git a/src/routes/services/[id]/_Services/_Services.svelte b/src/routes/services/[id]/_Services/_Services.svelte
index 03a94d311e..826a3bdc82 100644
--- a/src/routes/services/[id]/_Services/_Services.svelte
+++ b/src/routes/services/[id]/_Services/_Services.svelte
@@ -1,4 +1,6 @@
<script lang="ts">
+ import { browser } from '$app/env';
+
export let service;
export let isRunning;
export let readOnly;
@@ -12,6 +14,8 @@
import { errorNotification } from '$lib/form';
import { t } from '$lib/translations';
import { toast } from '@zerodevx/svelte-toast';
+ import cuid from 'cuid';
+ import { onMount } from 'svelte';
import Fider from './_Fider.svelte';
import Ghost from './_Ghost.svelte';
import Hasura from './_Hasura.svelte';
@@ -29,6 +33,7 @@
let dualCerts = service.dualCerts;
async function handleSubmit() {
+ if (loading) return;
loading = true;
try {
await post(`/services/${id}/check.json`, {
@@ -66,6 +71,12 @@
return errorNotification(error);
}
}
+ onMount(async () => {
+ if (browser && window.location.hostname === 'demo.coolify.io' && !service.fqdn) {
+ service.fqdn = `http://${cuid()}.demo.coolify.io`;
+ await handleSubmit();
+ }
+ });
</script>
<div class="mx-auto max-w-4xl px-6 pb-12">
diff --git a/src/routes/services/[id]/index.svelte b/src/routes/services/[id]/index.svelte
index a165912662..2a3bc0d260 100644
--- a/src/routes/services/[id]/index.svelte
+++ b/src/routes/services/[id]/index.svelte
@@ -30,8 +30,6 @@
</script>
<script lang="ts">
- import cuid from 'cuid';
- import { browser } from '$app/env';
import ServiceLinks from '$lib/components/ServiceLinks.svelte';
import Services from './_Services/_Services.svelte';
@@ -39,10 +37,6 @@
export let isRunning;
export let readOnly;
export let settings;
-
- if (browser && window.location.hostname === 'demo.coolify.io' && !service.fqdn) {
- service.fqdn = `http://${cuid()}.demo.coolify.io`;
- }
</script>
<div class="flex h-20 items-center space-x-2 p-5 px-6 font-bold">