Skip to content

Commit 21bee30

Browse files
committed
fix:always send valid spec, remove redundant syncing
1 parent 414fd53 commit 21bee30

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/+page.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@
6060
{#key data.site.providerRepositoryId}
6161
<UpdateRepository site={data.site} installations={data.installations} />
6262
{/key}
63-
<UpdateBuildSettings site={data.site} frameworks={data.frameworks.frameworks} />
63+
<UpdateBuildSettings
64+
site={data.site}
65+
frameworks={data.frameworks.frameworks}
66+
specs={data.specificationsList} />
6467
<UpdateRuntimeSettings site={data.site} frameworks={data.frameworks.frameworks} />
6568
<UpdateVariables
6669
{sdkCreateVariable}

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateBuildSettings.svelte

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515
import { getFrameworkIcon } from '$lib/stores/sites';
1616
import { page } from '$app/state';
1717
18-
let {
19-
site,
20-
frameworks
21-
}: {
22-
site: Models.Site;
23-
frameworks: Models.Framework[];
24-
} = $props();
18+
let { site, frameworks, specs } = $props();
2519
2620
let frameworkKey = $state(site.framework);
2721
let installCommand = $state(site?.installCommand);
@@ -94,6 +88,19 @@
9488
adapter = selectedFramework.adapters[0].key as Adapter;
9589
adptr = selectedFramework.adapters[0];
9690
}
91+
let specToSend = site?.specification;
92+
if (!specToSend && specs && specs.specifications?.length) {
93+
specToSend = specs.specifications[0].slug;
94+
site.specification = specToSend;
95+
}
96+
if (
97+
specs &&
98+
specs.specifications?.length &&
99+
!specs.specifications.some((s) => s.slug === specToSend)
100+
) {
101+
specToSend = specs.specifications[0].slug;
102+
site.specification = specToSend;
103+
}
97104
try {
98105
await sdk
99106
.forProject(page.params.region, page.params.project)
@@ -115,7 +122,7 @@
115122
site.providerBranch || undefined,
116123
site.providerSilentMode || undefined,
117124
site.providerRootDirectory || undefined,
118-
site?.specification || undefined
125+
specToSend || undefined
119126
);
120127
await invalidate(Dependencies.SITE);
121128
addNotification({

src/routes/(console)/project-[region]-[project]/sites/site-[site]/settings/updateResourceLimits.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
let specification = site.specification;
2020
let originalSpecification = site.specification;
2121
22-
$: originalSpecification = site.specification;
23-
2422
async function updateLogging() {
2523
try {
2624
await sdk

0 commit comments

Comments
 (0)