|
114 | 114 | if (specs && specs.specifications?.length) { |
115 | 115 | const enabledSpecs = specs.specifications.filter((s) => s.enabled); |
116 | 116 | 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)) { |
118 | 118 | site.buildSpecification = fallbackSlug; |
119 | 119 | } |
120 | | - if (!specs.specifications.some((s) => s.slug === site.runtimeSpecification)) { |
| 120 | + if (!enabledSpecs.some((s) => s.slug === site.runtimeSpecification)) { |
121 | 121 | site.runtimeSpecification = fallbackSlug; |
122 | 122 | } |
123 | 123 | } |
|
133 | 133 | } |
134 | 134 | // only allow enabled specsification for it |
135 | 135 | 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) |
137 | 137 | ? site.buildSpecification |
138 | 138 | : 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) |
141 | 140 | ? site.runtimeSpecification |
142 | 141 | : enabledSpecs[0]?.slug; |
143 | | - site.runtimeSpecification = runtimeSpecToSend; |
144 | 142 | try { |
145 | 143 | await sdk.forProject(page.params.region, page.params.project).sites.update({ |
146 | 144 | siteId: site.$id, |
|
163 | 161 | buildSpecification: specToSend || undefined, |
164 | 162 | runtimeSpecification: runtimeSpecToSend || undefined |
165 | 163 | }); |
| 164 | + site.buildSpecification = specToSend; |
| 165 | + site.runtimeSpecification = runtimeSpecToSend; |
166 | 166 | await invalidate(Dependencies.SITE); |
167 | 167 | addNotification({ |
168 | 168 | message: 'Build settings have been updated', |
|
0 commit comments