From ff49fbf07040f5ebe28ba46d81ca78135a0d22fb Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 27 Mar 2025 11:39:47 +0100 Subject: [PATCH] fix: ids in functions --- .../functions/create-function/manual/+page.svelte | 4 ++-- .../create-function/repository-[repository]/+page.svelte | 4 ++-- .../create-function/template-[template]/+page.svelte | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/routes/(console)/project-[project]/functions/create-function/manual/+page.svelte b/src/routes/(console)/project-[project]/functions/create-function/manual/+page.svelte index f8aa0e626..fb30c4327 100644 --- a/src/routes/(console)/project-[project]/functions/create-function/manual/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/create-function/manual/+page.svelte @@ -44,7 +44,7 @@ let isSubmitting = writable(false); let name = ''; - let id = ID.unique(); + let id: string; let runtime: Runtime; let entrypoint = ''; let buildCommand = ''; @@ -58,7 +58,7 @@ console.log(runtime); const func = await sdk.forProject.functions.create( - id, + id || ID.unique(), name, runtime, undefined, diff --git a/src/routes/(console)/project-[project]/functions/create-function/repository-[repository]/+page.svelte b/src/routes/(console)/project-[project]/functions/create-function/repository-[repository]/+page.svelte index b178ce34b..2c8a10390 100644 --- a/src/routes/(console)/project-[project]/functions/create-function/repository-[repository]/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/create-function/repository-[repository]/+page.svelte @@ -46,7 +46,7 @@ let isSubmitting = writable(false); let name = ''; - let id = ID.unique(); + let id: string; let runtime: Runtime; let entrypoint = ''; let buildCommand = ''; @@ -66,7 +66,7 @@ async function create() { try { const func = await sdk.forProject.functions.create( - id, + id || ID.unique(), name, runtime, undefined, diff --git a/src/routes/(console)/project-[project]/functions/create-function/template-[template]/+page.svelte b/src/routes/(console)/project-[project]/functions/create-function/template-[template]/+page.svelte index 66bae7604..47d5d9c97 100644 --- a/src/routes/(console)/project-[project]/functions/create-function/template-[template]/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/create-function/template-[template]/+page.svelte @@ -50,7 +50,7 @@ let isSubmitting = writable(false); let name = data.template.name; - let id = ID.unique(); + let id: string; let runtime: Runtime; let branch = 'main'; let rootDir = './'; @@ -70,10 +70,7 @@ onMount(async () => { if ($page.url.searchParams.has('runtime')) { - console.log(runtime); - console.log($page.url.searchParams.get('runtime')); runtime = $page.url.searchParams.get('runtime') as Runtime; - console.log(runtime); } if (!$installation?.$id) { $installation = data.installations.installations[0]; @@ -127,7 +124,7 @@ const rt = data.template.runtimes.find((r) => r.name === runtime); const func = await sdk.forProject.functions.create( - id, + id || ID.unique(), name, runtime as Runtime, data.template.permissions?.length ? data.template.permissions : undefined,