Skip to content

Commit 1499bcb

Browse files
committed
use enabledspecs
1 parent af337fd commit 1499bcb

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/routes/(console)/project-[region]-[project]/settings/webhooks/[webhook]/delete.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import { goto, invalidate } from '$app/navigation';
3+
import { page } from '$app/state';
34
import { base } from '$app/paths';
45
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
56
import Confirm from '$lib/components/confirm.svelte';
@@ -14,7 +15,7 @@
1415
let error: string;
1516
async function handleDelete() {
1617
try {
17-
await sdk.forProject($project.region, $project.$id).webhooks.delete({
18+
await sdk.forProject(page.params.region, $project.$id).webhooks.delete({
1819
webhookId: $webhook.$id
1920
});
2021
await invalidate(Dependencies.WEBHOOKS);
@@ -24,7 +25,7 @@
2425
message: `${$webhook.name} has been deleted`
2526
});
2627
trackEvent(Submit.WebhookDelete);
27-
await goto(`${base}/project-${$project.region}-${$project.$id}/settings/webhooks`);
28+
await goto(`${base}/project-${page.params.region}-${$project.$id}/settings/webhooks`);
2829
} catch (e) {
2930
error = e.message;
3031
trackError(e, Submit.WebhookDelete);

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@
114114
if (specs && specs.specifications?.length) {
115115
const enabledSpecs = specs.specifications.filter((s) => s.enabled);
116116
const fallbackSlug = enabledSpecs[0]?.slug ?? specs.specifications[0]?.slug;
117-
if (!specs.specifications.some((s) => s.slug === site.buildSpecification)) {
117+
if (!enabledSpecs.some((s) => s.slug === site.buildSpecification)) {
118118
site.buildSpecification = fallbackSlug;
119119
}
120-
if (!specs.specifications.some((s) => s.slug === site.runtimeSpecification)) {
120+
if (!enabledSpecs.some((s) => s.slug === site.runtimeSpecification)) {
121121
site.runtimeSpecification = fallbackSlug;
122122
}
123123
}
@@ -133,14 +133,12 @@
133133
}
134134
// only allow enabled specsification for it
135135
const enabledSpecs = specs?.specifications?.filter((s) => s.enabled) ?? [];
136-
let specToSend = enabledSpecs.some((s) => s.slug === site.buildSpecification)
136+
const specToSend = enabledSpecs.some((s) => s.slug === site.buildSpecification)
137137
? site.buildSpecification
138138
: enabledSpecs[0]?.slug;
139-
site.buildSpecification = specToSend;
140-
let runtimeSpecToSend = enabledSpecs.some((s) => s.slug === site.runtimeSpecification)
139+
const runtimeSpecToSend = enabledSpecs.some((s) => s.slug === site.runtimeSpecification)
141140
? site.runtimeSpecification
142141
: enabledSpecs[0]?.slug;
143-
site.runtimeSpecification = runtimeSpecToSend;
144142
try {
145143
await sdk.forProject(page.params.region, page.params.project).sites.update({
146144
siteId: site.$id,
@@ -163,6 +161,8 @@
163161
buildSpecification: specToSend || undefined,
164162
runtimeSpecification: runtimeSpecToSend || undefined
165163
});
164+
site.buildSpecification = specToSend;
165+
site.runtimeSpecification = runtimeSpecToSend;
166166
await invalidate(Dependencies.SITE);
167167
addNotification({
168168
message: 'Build settings have been updated',

0 commit comments

Comments
 (0)